Sheikh Ibn Baaz- may Allah have mercy on him- says:

Praying in Hijr Ismail is desirable because it is from the sacred house, and it was reported in an authentic tradition from the Prophet : That he prayed two raka’at upon entering the Ka’abah in the Year of the conquest of Makkah. The authenticity of this hadith is confirmed from a hadith of ibn Umar on the authority of Bilal, may Allah be pleased with both.

Also, it is confirmed that the Prophet said to Aaisha RA when she wanted to enter the Ka’abah: Pray in Al Hijr, for it is a part of the House (the Ka’abah)

As for the obligatory prayer, the cautious way is to avoid performing it in the Ka’abah, or Hateem, because the Prophet did not do that, and because some of the people of knowledge have said: The obligatory prayer is not valid in the Ka’abah, or Al Hijr, because it is part of the Ka’abah.

Thus it is known that it is prescribed to perform the obligatory prayer outside the Ka’aba and outside Al Hijr, following the example of the Prophet , and to avoid the disagreement of the scholars who say that it is not valid in the Kaaba or in al Hijr.