It is perhaps most striking when you come to the section at 7:7, titled in most Bible's something like "Ask, seek, knock." Here is that section:
"7 ‘Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. 8 For everyone who asks receives; the one who seeks finds; and to the one who knocks, the door will be opened.
9 ‘Which of you, if your son asks for bread, will give him a stone? 10 Or if he asks for a fish, will give him a snake? 11 If you, then, though you are evil, know how to give good gifts to your children, how much more will your Father in heaven give good gifts to those who ask him!
Jesus's point is very clear. Our Father in heaven is not like us, who have a serious problem with evil. That problem is made clear by all his teaching from 5:21 to this point. We are complicated; we have serious purity of motivation issues, but we still know how to give good gifts (and do other good things). However our Father in heaven is not like that. There is no evil (sin) that infects him at his core. So how much more will he, our Father in heaven, give good gifts to those who ask him!
By the same token I assume this means if we ask for bad gifts he won't give them. If we ask for a stone or a poisonous snake to eat he isn't going to say, "Here you are?" He will withhold from us anything that will do us harm.
Now keep this in mind and look back at the section most translations call something like, "Treasure in heaven." It is at chapter 6:19-21. Here it is:
19 ‘Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. 20 But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal. 21 For where your treasure is, there your heart will be also.
A simple way of thinking about this would be, don't look for reward now but reward then. Jesus is specifically talking about money here - don't pile up bank balance, property, possessions now. It is uncertain and does you no good in eternity. Instead, by how you live and what you set your heart on, store up the reward of heaven, the joy of your Father in heaven. As he is about to say in 6:33 "seek first his kingdom and his righteousness".
I take it then seeking treasure on earth is a bad thing, but seeking treasure in heaven is a good thing. Asking God for treasure on earth will not see our Father in heaven joyfully throwing out gifts. It would be like giving his children stones and vipers to eat. But when we are seeking treasure in heaven, when we come to him asking for heavenly treasures, then it is his delight to rain down gifts on the children he loves with an undying love.
Now, Jesus, perceptive as ever, notes "where your treasure is, there your heart will be also". And if your heart is set on misplaced treasure your prayers will continually be seeking what is bad for you. You will find again and again your Father's response will be akin to "of course not!" Why would I give you something that will only take you further from me. James (4:2-3), in his letter, is as blunt as ever:
"You do not have because you do not ask God. 3 When you ask, you do not receive, because you ask with wrong motives, that you may spend what you get on your pleasures."
If we are finding that our prayers are going unanswered, and by that I mean effectively our Father is saying no, it may well pay us to think about where our treasure is. Because if we are aiming to store up treasure on earth, whether money or property or reputation or promotion or perfect children or a big score on that computer game or.... , then our treasure is misplaced and so our heart is misplace, and therefore, most likely, (though we may not see it straight away,) we keeping asking our Father for stones and vipers! Misplaced treasure = unanswered prayer.