He was asked:
Are there any places on earth where prayer is disliked?
He answered:
Yes. Prayer is prohibited in certain places. It is established in the Sahīh that the Prophet, may Allah bless him and grant him peace, was asked about praying in camel enclosures. He said:
“Do not pray in them.”
He was asked about praying in sheep pens and said:
“Pray in them.”
It is reported in the Sunan that he said:
“The whole earth is a place of prayer, except graveyards and bathhouses.”
It is also reported in the Sahīh that he, may Allah bless him and grant him peace, said:
“May Allah curse the Jews and Christians: they took the graves of their prophets as places of worship.”
He was warning against what they had done.
It is also reported in the Sahīh that he said:
“Those who came before you used to take graves as places of worship. Beware! Do not take graves as places of worship, for I forbid you to do so.”
It is reported in the Sunan that he forbade prayer on land that had been swallowed up by the earth.
In Sunan Ibn Mājah and elsewhere, it is reported that he forbade prayer in seven places: graveyards, slaughterhouses, refuse dumps, public thoroughfares, bathhouses, and the roof of the Sacred House.
Some jurists explain the prohibition concerning these places—apart from the roof of Allah’s Sacred House—on the grounds that they are likely to contain ritual impurities. Others regard the prohibition as a purely devotional injunction.