Answer
(Fatwa: 2300/2095=D/1429)
The land wherein a mosque is built is mosque from beneath earth to the sky. It cannot be allowed to use any floor of the mosque for other purposes except performing slalah and zikr. So it is a severe sin to use the basement of the mosque for toilet etc, it is strictly prohibited; even the real endower (waqif) is not allowed to use any floor of the mosque for any purpose other than salah.
Yes it would have been possible if the real waqif in the beginning would have declared some parts of the land to be out of mosque for other essential things like wadhu, toilet etc. But, once it was declared as mosque, so now no floor and no part of it can be used for any purpose other than salah. Therefore, it is in no case allowed to build toilet etc therein now. You are not allowed to change the existing condition of mosque and then endow it again.
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband