I live in a house with 5 people including myself and I am the only Muslim living here. I'm still new to Islam and practice prayer but I wish to not be disturbed. I share a room with someone and he comes and goes in our room many times throughout the day. I was wondering if a closet will be okay to pray. Will this be alright? I wouldn't want to perform prayer in the bathroom because I doubt that is acceptable. or is it?
Actually there are ten places where scholars say it is either haram or makruh to pray, I tried adding the evidences that are used to support this view for each of them:
'Aisha and 'Abdullah bin 'Abbas said, "When Allah's Messenger (ﷺ) became ill seriously, he started covering his face with his woolen sheet, and when he felt short of breath, he removed it from his face and said, 'That is so! Allah's curse be on the Jews and the Christians, as they took the graves of their prophets as (places of worship),' intending to warn (the Muslims) of what they had done." (Sahih al-Bukhari)
An exception for this case is the funeral (janazah) prayer as there are ahadith showing that it can be perforemd there.
Mosques built on graves:
Um Habiba and Um Salama mentioned about a church they had seen in Ethiopia in which there were pictures. They told the Prophet (ﷺ) about it, on which he said, "If any religious man dies amongst those people they would build a place of worship at his grave and make these pictures in it. They will be the worst creature in the sight of Allah on the Day of Resurrection." (Sahih al-Bukhari)
A man asked the Messenger of Allah (may peace he upon him) whether he should perform ablution after (eating) mutton. He (the Messenger of Allah) said: Perform ablution it you so desire, and if you do not wish, do not perform it. He (again) asked: Should I perform ablution (after eating) camel's flesh? He said: Yes, perform ablution (after eating) camel's flesh. He (again) said: May I say prayer in the sheepfolds? He (the Messenger of Allah) said: Yes. He (the narrator) again said: May I say prayer where camels lie down? He (the Holy Prophet) said: No. (Sahih Muslim)
The majority of scholars say that this prohibition is equal to a dislike, while the hanbalis consider it haram.
Wash- or bathrooms
and the narrator Musa said: As far as Amr thinks, the Prophet (ﷺ) said: The whole earth is a place of prayer except public baths and graveyards. (Abu Dawod, Sunan ibn Majah and Jami' at-Tirmidhi who commented that this hadith has issues)
Any place that is a refuge for Satan (places where people do things that are haram):
We stopped for rest along with the Messenger of Allah (ﷺ) and did not awake till the sun rose. The Apostle of Allah (ﷺ) then told us that everybody should take hold of his camel's nosestring (get out of this ground) for it was the place where devil had visited us. We did accordingly. He then called for water and performed ablution and then performed two prostrations. Ya'qub said: Then he prayed (performed) two prostrations. then takbir was pronounced for prayer and then he offered the morning prayer (in congregation). (Sahih Muslim)
Land that has been taken or gained in an unlawfull manner:
from Abu Salama bin 'Abdur-Rahman who had a dispute with some people on a piece of land, and so he went to `Aisha and told her about it. She said, "O Abu Salama, avoid the land, for Allah's Messenger (ﷺ) said, 'Any person who takes even a span of land unjustly, his neck shall be encircled with it down seven earths.' " (Sahih al-Bukhari)
The mosque of dirar and based on that any mosque that is used to split Muslims or the Muslim communities:
And [there are] those [hypocrites] who took for themselves a mosque for causing harm and disbelief and division among the believers and as a station for whoever had warred against Allah and His Messenger before. And they will surely swear, "We intended only the best." And Allah testifies that indeed they are liars. (107)
Do not stand [for prayer] within it - ever. A mosque founded on righteousness from the first day is more worthy for you to stand in. Within it are men who love to purify themselves; and Allah loves those who purify themselves. (9:107:108)
Places of (earlier) punishments of Allah:
(While we were going for the Battle of Tabuk and when we reached the places of the dwellers of Al- Hijr), Allah's Messenger (ﷺ) said about the dwellers of Al-Hijr (to us). "Do not enter (the dwelling places) of these people unless you enter weeping, but if you weep not, then do not enter upon them, lest you be afflicted with what they were afflicted with." (Sahih al-Bukhari)
Between the columns:
We prayed behind one of the Amirs, the people compelled us such that we prayed between two columns. When we had prayed, Anas bin Malik said: 'We would be prevented from this during the time of Allah's Messenger.'" (Jami' at-Tirmdihi)
Ad-Darqtotni complilled a hadith -see here in Arabic- that shows that it is prohibited (disliked?) for an imam to pray on a higher level than the rest of the congregation.
In addition to that Scholars also say that it is not allowed to pray on top of the Ka'aba.
Note that the basis for considering all these prohibition to be rather makrooh instead of haram beside the verse (2:125) quoted in the other post ist the hadith:
The Prophet (ﷺ) said: "I have been given five things which were not given to anyone else before me. Allah made me victorious by awe (of frightening my enemies) for a distance of one month's journey. The earth has been made for me (and my followers) a place for praying and something with which to perform Tayammum (to purify oneself for prayer). Therefore, anyone (of my followers) can pray (anywhere) and at any time that the Salat (prayer) is due."
(Bulugh al-Maram, where it is said that the hadith is quoted in both sahihs the most relevant statement also appears in all the Sunan)
There are two basical principles that one should follow is that the place one is praying at doesn't have any shirk related "Objects" and that it is considered as tahir.
One of the conditions for Prayer is Taharah (purity) of the body, clothes and place. So you can not pray in any place soiled by ritual impurities like urine, feces, blood, reproductive fluids, wine, pork, dead bodies etc.
أن طهرا بيتي للطائفين والعاكفين والركع السجود
Purify My House for those who perform Tawaf and those who are staying [there] for worship and those who bow and prostrate [in prayer].
If your closet is clean from these, you can pray in it. You may also consider getting a prayer mat.