Your wife says she wants a divorce. That happens to be the very last thing in the world you desire. You recognize that the two of you have been struggling with issues but you still love her very much and not being with her isn't something you want to consider. You feel stuck between what you want for the future and her intention to leave you. You shouldn't be giving in to the idea of divorce if the marriage is still vitally important to you. Before you agree to let her walk out of your home and your life, you need to try and get her to see that the two of you still have a chance at happiness together.
When your wife says she wants a divorce you have to consider the circumstances surrounding her announcement. During a heated argument things are sometimes said that cause one person to throw out the idea of divorce for the sole purpose of hurting the other person. They know it will hurt them so much that the arguing will likely stop. If that is what happened with your wife consider the idea that she may have said it only because she was so upset with you in the moment.
If your wife has come to you and told you that she wanted a divorce when everything between the two of you seemed okay, that's a much more serious problem. Obviously, in this case she's given the idea some careful and considerate thought. She's not jumping to an emotional decision. She's likely weighed the pros and cons and has come to the conclusion that leaving you is what is best for her.
In this case you have to handle the problem head on with all your energy. Before you react to her by telling her that you won't even listen to her reasons behind her desire to separate, take a step back from the situation.
You have to try and see things from your wife's point of view. She wouldn't be telling you that she wanted a divorce unless she felt it was necessary. If you refuse to talk about it, she'll feel that her needs aren't valued within the marriage and it will add to her desire to divorce you.
Talk with your wife about what she's feeling. Listen carefully to her reasoning behind her decision to end the marriage. Then explain your side of things and how you believe that you two still belong together. Make it clear that your sole purpose right now is to rebuild the marriage because of your deep love for her.
Compromise is at the cornerstone of any couple's quest to save their marriage. Once your wife sees that you're serious about working on the marriage she may decide to put her plans to divorce you on hold. If that happens, you'll have your second chance and you need to do whatever is necessary to make her feel loved and cherished within the marriage again.