Praise be to Allah.
I‘tikaaf means staying in the mosque to worship Allah, and it is something that is done only in the mosques and is not valid if done elsewhere.
Ibn Qudaamah (may Allah have mercy on him) said: I‘tikaaf observed anywhere but in a mosque is not valid if the person observing i‘tikaaf is a man. We do not know of any difference among the scholars concerning this. The basic principle with regard to that is the verse in which Allah says (interpretation of the meaning): “And do not have sexual relations with them (your wives) while you are in I‘tikaaf (i.e. confining oneself in a mosque for prayers and invocations leaving the worldly activities) in the mosques” [al-Baqarah 2:187]. So it is something that is only for the mosques. If it were valid to preserve i‘tikaaf anywhere else, the prohibition on intimacy would not have been mentioned only with regard to the mosques, because intimacy is forbidden during i‘tikaaf in all cases. According to the hadeeth of ‘Aa’ishah, she said: “The Messenger of Allah (blessings and peace of Allah be upon him) used to put his head into (my room) when he was in the mosque, and I would comb his hair. He did not enter the house except for some need when he was observing i‘tikaaf.” Al-Daaraqutni narrated with his isnaad from al-Zuhri, from ‘Urwah and Sa‘eed ibn al-Musayyab from ‘Aa’ishah in a hadeeth: The Sunnah is for the person who is observing i‘tikaaf not to go out except for necessary purposes, and there is no i‘tikaaf except in a mosque where prayers are offered in congregation (jamaa ‘ah).
End quote from al-Mughni, 3/65
With regard to this separate place, it does not seem that it is part of the mosque that is built for prayer, so it is not valid to observe i‘tikaaf there. The guideline in defining what is included in the rooms of the mosque and what is not included is as follows:
1.If the room that is connected to the mosque was built to be a mosque, i.e., the builder of the mosque intended it to be part of the mosque in which prayers are offered, then it comes under the same rulings as the mosque and it is permissible to observe i‘tikaaf there, and women who are menstruating or bleeding following childbirth (nifaas) should not be allowed to enter it.
But if it was intended to be extra space for teaching or holding meetings, or as accommodation for the imam or muezzin, and not as a place for prayer, it does not come under the same rulings as a mosque in that case.
2.If the intention of the one who built the mosque is not known, then the basic principle is that whatever is within the wall of the mosque and has a door into the mosque comes under the same rulings as the mosque.
3.The courtyard that is enclosed within the wall of the mosque comes under the same rulings as the mosque.
Al-Nawawi (may Allah have mercy on him) said: The walls of the mosque, both inside and outside, comes under the same rulings as the mosque and it is obligatory to protect them and respect their sanctity. The same applies to its roof, the well inside it, and its courtyard. Al-Shaafa‘i and his companions (may Allah have mercy on them) stated that it is valid to observe i‘tikaaf in its courtyard or on its roof, and the prayer of one who follows an imam who is inside the mosque in these places is valid.
End quote from al-Majmoo‘, 2/207
It says in Mataalib Ooli al-Nuha (2/234): Also included as part of the mosque are its roof and its enclosed courtyard. Al-Qaadi said: If it has a wall and gate, then they are like the mosque, because they are part of it and belong to it. If it is not enclosed, then it does not come under the same rulings as the mosque. Also part of the mosque is the minaret, if it or its door is in the mosque; but if it or its gate is outside, even if they are close, and the person who is observing i‘tikaaf goes out to them to give the adhaan, his i‘tikaaf is rendered invalid. End quote.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: With regard to a room that is inside the mosque, is it permissible to observe i‘tikaaf in it? He replied: That depends. The one who studies the words of the fuqaha’ in general will say that it is part of the mosque, because they say that the room that is enclosed by the walls of the mosque are part of the mosque. But the one who thinks that it was not built as part of the mosque and that it is a room for the imam, will regard it as being like the houses of the Messenger (blessings and peace of Allah be upon him), because the houses of the Messenger had doors that opened into the mosque, but despite that they were houses and the Messenger (blessings and peace of Allah be upon him) did not go out to them [i.e., during i‘tikaaf]. So to be on the safe side, the one who is observing i‘tikaaf should not do it there. But the custom of people nowadays is that rooms that are in the mosques are regarded as being part of the mosque.
End quote from Sharh al-Kaafi
And Allah knows best.