You do not have, because you do not ask God. When you ask, you do not receive, because you ask with wrong motives... —James 4:2-3
I have lived long enough, as far as I can tell, to thank God for every unanswered prayer. That is, prayers prayed in the distant past. To be honest, I have offered prayers more recently that have gone unanswered (so far), which makes no sense to me at all. But I predict that, in the end, I will have no complaints. God is not only sovereign, but He is also loving and gracious. No good thing does He withhold from those who sincerely try to do His will in everything (Ps. 84:11).
Unanswered prayer is still an enigma—that is, puzzling in the light of Jesus' words, "You may ask me for anything in my name, and I will do it" (John 14:14). God does not answer prayers that are not in His will. After all, John said, "This is the confidence we have in approaching God: that if we ask anything according to his will, he hears us" (1 John 5:14).
I can only conclude that asking in Jesus' name must in some direct sense relate to God's will. The enigma of unanswered prayer lies in the apparent incongruity between what seems good to us at the time and what God knows is good for us.
Sometimes our prayers, which seem so right, flow from a faulty theology. When we are in love with our theological assumptions—and can't imagine they could be wrong—we tend to presume God surely agrees with us! The disciples asked the resurrected Christ, "Lord, are you at this time going to restore the kingdom to Israel?" (Acts 1:6). It had not crossed their minds that Jesus never once planned to do anything of the kind.
Although unanswered prayer is a mystery, there is also an explanation. It is only a matter of time before we will be given an explanation. But it comes down to this: God has a better idea than that which we asked for.
Excerpted from The Thorn in the Flesh (Charisma House, 2004).