the French ambassador to Niger has been effectively sacked and become persona non grata with no diplomatic immunity Surely now it's just a building with an unwelcome squatter which the host country does not want on their soil?
I'm not familiar with the situation, but generally speaking diplomatic immunity extends to more than the ambassador. Unless Niger has decided to [completely] break off diplomatic relations with France, the [loss of] status of the ambassador doesn't result in loss of status for the embassy building. N.B. here's the note from the Niger ministry (controlled by the junta), it makes no mention of breaking off relations or closing the embassy, and the last para rather argues for the opposite:
CM du 26 août 2023, a l’honneur de l’informer que la question de l’agrément de l’Ambassadeur de France est irrévocable et toute observation à ce sujet est sans objet.
Par conséquent, au terme du délai de quarante huit heures (48h) expiré à compter du 28 août 2023, l’intéressé ne jouit plus de privileges et immunités attachés a son statut de membre du personnel diplomatique de l’Ambassade. Les cartes diplomatiques et les visas de l’intéressé et des membres de sa famille sont annulés. Les services de police sont instruits afin de procéder à son expulsion.
Le Ministére des Affaires Etrangéres, de la Coopération et des Nigériens à l’Exterieur de la Republique du Niger saisit cette occasion pour renouveler au Ministére de l’Europe et des Affaires Etrangeres de la République Française les assurances de sa haute considération.
MINISTERE DE L’EUROPE ET DES AFFAIRES ETRANGERES
DE LA REPUBLIQUE FRANCAISE
OTOH your description of the situation might not actually be correct. According to Anandolu Agensi, Niger (or rather the ruling junta) might have done exactly that, i.e. broken off diplomatic relations with France and some other countries. FWTW, the BBC phrased it the same way "[the junta] announced that it was cutting diplomatic ties with Nigeria, Togo, the US and France [...]".
It's also worth nothing here that France doesn't recognize the junta [which came to power in a coup in July, it seems] as a legitimate government of Niger. Which is why the French ambassador refused to follow their orders (at Paris/Macron's explicit instructions, I might add). The same goes for the junta's call for the French troop contingent to leave Niger.
Finally, the US doesn't seem to call it a coup and has sent a replacement ambassador for their own... So the [older] press descriptions that Niger broke off diplomatic relations with the US appear to be wrong. My guess is that these moves (expelling ambassadors) were designed to force a recognition of sorts of the junta as legitimate government (rather than breaking off relations unconditionally--as reported earlier by the press), i.e. if the foreign power acquiesced and sent a replacement ambassador... Perhaps the most confusing/amusing bit is that both the US and Niger (now) are denying their former ambassador was expelled.
Niger's Foreign Ministry has told the U.S. government that images of letters circulating online calling for the departure of certain American diplomatic personnel were not issued by the ministry, a U.S. State Department spokesperson said.
"No such request has been made to the U.S. government," the spokesperson said after AFP reported that Niger had given the U.S. ambassador 48 hours to leave the African country.
The US managed to wiggle themselves out of outright formally recognizing the junta though:
Due to the current political crisis in Niger, Ambassador FitzGibbon will not formally present credentials.
Also, back at the end of July, supporters of the junta did physically storm the French embassy building. In similar situations countries did formally break off diplomatic relations before...