God gives -- if asked. That's why we pray. If we don't get what we ask for it is because the prayer is empty or we pray with an evil heart.
We do not ask for His will to be done; we make a statement of trust in His goodness. When we pray and say "Thy will be done" it means whatever happens we trust in God's mercy and justice; that whatever happens to us and the world is mericful and just even if we don't see it that way.
Those whom we love we trust. We are told to love God with all our heart, mind and soul; if so, then we must trust Him the same way. What makes Christianity unique compared to all other religions is that our faith is love -- in those we love, we have faith; God above all. In love, we fulfill the law.
God gives -- if asked. That's why we pray. If we don't get what we ask for it is because the prayer is empty or we pray with an evil heart.
What about the other option that we prayed for something honestly, but God knew it would be bad for us (we didn't), and so it didn't happen? One example would be praying to get a particular job. If God already knows it would be a disaster, He might not give it to us to protect us.