It's no surprise that one shouldn't pray for bad things to happen, for it's always wicked to attempt to bring about evil. But perhaps surprisingly one shouldn't pray for good things either. For if there is an Omnipotent, Omniscient and Omni-Benevolent Deity who intervenes at all in the workings of the world, then He will do whatever is best anyway, and if you pray for what He wouldn't otherwise have done then it must, perhaps unknown to you, be wrong. If there is no God then He will not answer your prayers, although they might be efficacious in other ways.
1 Smilansky, Saul, ‘A Moral Problem about Prayer’, Think, No. 36, Vol. 13, Spring (2014),104 – 113CrossRefGoogle Scholar
2 My understanding of this point is due to an article by Renford Bambrough, I believe arguing against a view of Sartre about this case, I think (although I am not sure) in his article ‘Unanswerable Questions’ (of which there are none, even if we will never know the correct answers) in Proceedings of the Aristotelian Society Supplement, 1966.
3 Words in brackets slightly altered by me for scanning etc. Googling this gave me the information that the poem is in ‘The Stonemason’ by Cormac McCarthy, but I rather think it is by Hilaire Belloc, although I cannot find the original.
I am extremely grateful to Peter Cave for pointing out some errors in an original version of this piece, however painful this might have been. It doesn't follow that he agrees with everything that is left. My grateful thanks for clarifications are also due to Sophie Bolat and to Stephen Law.