We are not at liberty to pray randomly for whatever our selfish minds conceive nor are we permitted to come into His presence and vent our silly notions and mindless ramblings. If God signed all our petitions without discretion, He would end up giving away His glory.
There is a law of prayer, a law meant to weed out self-centered prayers, while at the same time making it possible for honest seekers to ask in confidence. In other words, we can pray for whatever we will, as long as it is His will.
"And this is the confidence that we have in him, that, if we ask anything according to his will, he heareth us: and if we know that he hear us, whatsoever we ask, we know that we have the petitions that we desired of him" (1 John 5:14).
The disciples were not praying according to God's will when they prayed with vindictiveness. They petitioned God thusly, “‘Do you want us to command fire to come down from heaven and consume them?’ But He turned and rebuked them, and said, ‘You do not know what manner of spirit you are of’” (Luke 9:54-55, NASB).
Job, in his sorrow, begged God to take his life away. What if God had answered his prayer? Such praying was contrary to the will of God. The Word warns, "Be not rash with thy mouth, and let not thine heart be hasty to utter anything before God” (Ecclesiastes 5:2).
Daniel prayed the right way. First, he went to the Scriptures and searched out the mind of God. Then, after receiving clear direction, and sure of God's will, he ran to God's throne with a mighty assurance. “And I set my face unto the Lord God, to seek by prayer” (Daniel 9:3).
We know too much about what we want and too little about what God wants. Our prayers are aborted when they are not according to His will.