This October 2002 article in Haaretz refers to an Israeli Health Ministry decision to allow a family of Kohanim to select the gender of their children for non-medical reasons.
For the first time in Israel, in a move that has set off a medical and moral controversy, the Health Ministry has given a couple permission to predetermine the gender of their child for no medical reason.
[...]
The case of the young ultra-Orthodox couple, however, came with another special story, stemming from the fact that the husband is a Cohen: The ultra-Orthodox parents want to keep the sperm donation a secret, but if the woman was to give birth to a male child, they would only be able to keep the matter under wraps until the boy is 13 years old. When the son of a Cohen celebrates his bar mitzvah and goes up to read from the Torah, he is heralded in synagogue as a Cohen. In the case of the young couple, however, such an announcement would be a halakhic violation, as the boy would not be the biological son of the father, and the parents would be forced to reveal the issue of the sperm donation.
In order to avoid the dilemma, the couple decided that they wanted a female child. A daughter, they explained, would never go up to read from the Torah; the community would not know that she was not their biological child; and they wouldn't have to tell her either.
I would imagine that an "ultra-Orthodox" couple would not do this without consulting a rabbi, and indeed I spoke with Rabbi Gideon Weitzman about it after his presentation at Torah in the City, who told me that he was involved in that case.
Has this case been recorded/discussed in responsa or halachic literature? I'd like to look at a decision or an analysis thereof in print, if possible. The Haaretz article does not mention a halachic decision, or the name of a rabbi involved.
(I tried emailing Rabbi Weitzman through the Puah Institute's contact form, but the emails kept bouncing...)