Someone may think that mud or dirt is not permitted but you can pray on that I understand. Why is this and what other "dirty" surfaces can you pray on which a non-Muslim would think of? You are not required to pray on a carpet or prayer mat.
First of all note that in fiqh: dirty is no synonym of najis and tahir is no synonym of clean. Najis is what Allah considers najis you a nurse or doctor may clean your wounds with alcohol, but Alcohol is najis. You may not want to drink used water, but it is tahir.
This hadith from sahih Muslim tells us that we can -basically- pray where ever we are:
I have been given superiority over the other prophets in six respects: I have been given words which are concise but comprehensive in meaning; I have been helped by terror (in the hearts of enemies): spoils have been made lawful to me: the earth has been made for me clean and a place of worship; I have been sent to all mankind and the line of prophets is closed with me. (Sahih Muslim)
There are other narrations:
The Prophet (ﷺ) said, "I have been given five things which were not given to any one else before me.
-1. Allah made me victorious by awe, (by His frightening my enemies) for a distance of one month's journey.
-2. The earth has been made for me (and for my followers) a place for praying and a thing to perform Tayammum, therefore anyone of my followers can pray wherever the time of a prayer is due.
-3. The booty has been made Halal (lawful) for me yet it was not lawful for anyone else before me.
-4. I have been given the right of intercession (on the Day of Resurrection).
-5. Every Prophet used to be sent to his nation only but I have been sent to all mankind. (Sahih al-Bukhari and sahih Muslim)
Imam Muslim also has a hadith quoting six things our Prophet have been given which were not given to any body else before him, which was also compiled by at-Tirmidhi.
A clear answer also can be found in this hadith:
The Messenger of Allah (ﷺ) said: 'The earth has been made for me a place of prostration and a means of purification, so wherever a man of my Ummah is when the time for prayer comes, let him pray.'" (Sunan an-Nasa-i)
This means where ever you are you could perform the prayer unless this surface has some clear signs of najasa on it (smell, color, taste).
For example lets say you pray on a carpet where you can smell the odor of alcohol... this is not permissible.
Some of the najasat beside alcohol are urin and excrement.