According to the Magen Avraham, it would still be permissible for a kohen’s pregnant wife to enter a cemetery, even if she knows with certainty that the fetus is a male, because of taharah baluah.
Regarding the sfek sfeika of the Rokeiach, is one obligated to find out whether the fetus is a male in order to reduce the doubt to only one safek? Rav Akiva Eiger (haga’os to Shulchan Aruch, Yoreh De’ah 18:12) says that if someone can resolve only one of the sfeikos of a sfek sfeika, he is not obligated to do so. Only if he can resolve both sfeikos is he obligated to investigate. Thus, even according to the Rokeiach, one need not find out whether the fetus is a male or female, since this will not clarify both sfeikos. If one does know that the fetus is a male the heter of the Rokeiach would not apply, but the Magen Avraham’s heter would still apply.