James 1
5 If any of you lacks wisdom, let him ask of God, who gives to all liberally and without reproach, and it will be given to him. 6 But let him ask in faith, with no doubting, for he who doubts is like a wave of the sea driven and tossed by the wind. 7 For let not that man suppose that he will receive anything from the Lord; 8 he is a double-minded man, unstable in all his ways.

This starts about wisdom, but this conversation gets MUCH deeper than just wisdom.
Here is a quote from Charles Spurgeon:
We notice that not only must one come in faith, but one must also ask in faith; and this is where the prayers of many people fail. “You know, dear friends, that there is a way of praying in which you ask for nothing, and get it.”

God is a faith God. In all things, you MUST believe and have faith that He is listening and wants to reward those who diligently seek Him.

Another thought to mull over here, is one not so simple. When you pray, if you don’t receive, before you create a new doctrine about “God saying no,” why not judge yourself? Why not analyze how you prayed? Why not analyze your heart to find out if your faith in the prayer was genuine?