"When you ask, you do not receive, because you ask with wrong motives, that you may spend what you get on your pleasures."~ St. James (James 4:3)
I daresay most people ask with wrong motives most of the time. God's not a heavenly vending machine.
My faith has been thoroughly shaken by this. God transcends our petty prayers. He is. Period. It doesn't matter whether we receive what we pray for. Indeed if most of our prayers are wrong it's a waste of time and energy to pray them.
Most answered prayers mean nothing and shouldn't be used to strengthen our faith in God. Most unanswered prayers mean exactly as little and shouldn't be used to discredit our faith. We believe in God because He is. Nothing more, nothing less. Every other ground is sinking sand.