Now don't just jump into this... but I thought it would be important to mention this unique ruling in Maliki fiqh for those who cram for hours studying in coffee shops or libraries and don't have a place to pray, especially in the winter when the salat is one after the other and it's too cold to go outside. And it also applies to people who visit their non-Muslim families and cannot find a single room to lock the door and make salat. So here goes...
When it comes to places of prayer, Qadi Abu Bakr b. al-‘Arabi says, “Every hadith about places of prayer is weak except, ‘The entire earth was made for me as a source of purification and a place of prayer.’”
The two Tirmidhi hadiths which Qadi Abu Bakr (as well as Malik and Tirmidhi himself) deem weak are: “All of the earth is a masjid except graves and bathrooms,” and “The Prophet peace be upon him prohibited salat in seven places: garbage dumps, slaughter houses, graves, the middle of the road, bathrooms, camel grazing grounds and above the Ka’ba.”
In Maliki fiqh, there is no location where salat is prohibited in itself and renders the prayer invalid, even if it is a bathroom, a temple, church or graveyard of Muslims or non. The only condition is that there not be any najasa in the spot where your feet, knees, hands and forehead touch. If there was najasa under your mat, but it didn't get to your skin, you're good. If there was najasa two inches away, you're still good. (See: Maliki Fiqh & Its Evidences, by Habib Bin Tahir, or any expanded Maliki text.)
Two of the seven places are discouraged for prayer due to other hadiths about them. The first is any temple or place of worship of non-Muslims due to Sayyidna ‘Umar b. al-Khattab’s disocuragement: “We do not enter them because of the idols in them” (Bukhari). So we would only pray there due to necessity, as Ibn 'Abbas did. The second is camel grazing grounds, which we don't have to worry about, but for the sake of it, the reason is their unpredictable and violent nature, not najasa (Muslim, Abu Dawud).
While Maliki law would allow prayer anywhere, even a bathroom, there does exist in fiqh a concept of ‘what is acted upon’ (al-ma’mul bihi), which is in essence the custom of the community on an issue. In general, Muslims apply the aforementioned seven prohibited places hadith and as such, it would be prudent to observe them in normal circumstances, so as not to cause confusion or go against the grain of the jama'a for no reason. However, in cases where one would miss the prayer, then the above permissibilities should be applied, for few things are ever worse than missing salat.