Sunan Ibn Majah, Book 4, Hadith 11 (Ibn Majah 745)

It was narrated that Abu Sa'eed Khudri said:

"The Messenger of Allah said: 'All the earth is a mosque, except for graveyards and Hammam.'"