You go boldly to the throne of grace and petition the Lord for something. In your prayers you ask with specifics (James 4:2) and express a desire for His will to be done (Mat 26:39c). So what do you do when the King says, "no."?
In understanding how we should respond, consider this verse:
For the LORD God is a sun and shield; the LORD bestows favor and honor. No good thing does he withhold from those who walk uprightly.A powerful promise that we believers can depend on. But we need to look at that verse closely. First, there is the prerequisite of walking uprightly. If we aren't abiding in Christ, walking with Him, and keeping His commandments, then He will not answer our prayers affirmatively. If He were to answer a prayer while we are in rebellion, then He would be telling us that rebellion is acceptable to Him. (which it is not)
If we are walking uprightly, then we need to consider if the thing that we were asking for was "good". Does scripture support the belief that what was being requested was good? Maybe it was neutral, neither good nor evil.
Maybe the thing was not good for you specifically. Vanilla milkshakes are good. They're creamy, sweet, and frosty goodness. But if a person is lactose-intolerant, then a milkshake would result in abdominal pains. If a person is diabetic, then a milkshake could potentially be life-threatening.
Maybe the thing was good but it was the timing that was bad. Would you want to drink a filling vanilla milkshake moments before you are invited to a surprise steak and lobster dinner?
You get the idea. When the King says "no", then our response should be to give Him praise for protecting us from unforeseen dangers, imperfect timing, or to draw attention to the deficiencies in our relationship with Him.