"Ye ask, and receive not, because ye ask amiss, that ye may consume it upon your lusts".- James 4:3
But more importantly, it is possible to pray prayers that must be answered.
"Elias was a man subject to like passions as we are, and he prayed earnestly that it might not rain: and it rained not on the earth by the space of three years and six months. And he prayed again, and the heaven gave rain, and the earth brought forth her fruit." - James 5:17-18
Elijah prayed, confidently and consistently. He prayed seven times with deep inner assurance.
I Kings 18:41-46
41 And Elijah said to Ahab, "Go up, eat and drink; for there is a sound of the rushing of rain."
42 So Ahab went up to eat and to drink. And Elijah went up to the top of Carmel; and he bowed himself down upon the earth, and put his face between his knees.
43 And he said to his servant, "Go up now, look toward the sea." And he went up and looked, and said, "There is nothing." And he said, "Go again seven times."
44 And at the seventh time he said, "Behold, a little cloud like a man's hand is rising out of the sea." And he said, "Go up, say to Ahab, 'Prepare your chariot and go down, lest the rain stop you.'"
45 And in a little while the heavens grew black with clouds and wind, and there was a great rain. And Ahab rode and went to Jezreel.
46 And the hand of the LORD was on Elijah; and he girded up his loins and ran before Ahab to the entrance of Jezreel.