Consider x's faithful Christian prayer that y would always avoid some sin. (Perhaps x=y, and perhaps they are distinct.) Such prayers are indeed offered, and yet it does indeed happen that sometimes y does commit that sin. This is more puzzling than cases where x prays that y be healed of some physical ailment, because sin is much worse, perhaps "incomparably worse", than any physical ailment.
Libertarians have the beginning of a story about cases like that. For God to ensure the literal fulfillment of such a prayer would require God either to take away from y the opportunity to commit the sin or to take away y's freedom, and in both cases God would be depriving y of a good. God won't give us a serpent when we ask for a fish, and he may well not give us a serpent even if we ask for a serpent. I am inclined to think that God always gives us a gift that is in some sense at least as worth getting as the one we asked for, and it may well be that it is better to get the opportunity and freedom to sin, together with the grace to resist temptation if one rejects not the grace, than to get none of these, but avoid the risk of sin.
Compatibilists have a little bit more difficulty with the puzzle, I think. I think they will say a story about how God is glorified by y's punishment and/or redemption after the sin. I think this works better if one is a universalist (I really think that in the end a Calvinist view of grace forces one into universalism), since the universalist can at least say that there is always redemption, and hence while x doesn't get exactly what x prayed for, y's redemption, which is what x presumably really wanted most of all, is still assured by other means. But it is tougher if one is not a universalist.