I'm wondering about the grammar: what role is that "it" playing in that sentence? Is it a personal pronoun or a dummy pronoun?
1.) The word "it" is the grammatical subject -- we know this because of the subject-auxiliary inversion in the interrogative clause.
2a.) Depending on the context, it could be reasonable for a person to consider that the word "it" is a dummy pronoun in a truncated it-cleft construction. (note: A dummy pronoun does NOT have an antecedent.)
2b.) Depending on the context, it could be reasonable for a person to consider that the word "it" is being used in an anaphoric relation to its antecedent which is the baby.
For #2a: In some contexts, the word "it" could be considered to be a dummy pronoun in an it-cleft construction, one that has been truncated and is in the form of an interrogative clause.
A dummy pronoun does not have an antecedent. (Note that a dummy pronoun doesn't have an antecedent because it is not in an anaphoric relation -- that's a reason why it is called a "dummy pronoun".)
It is truncated because the it-cleft's relative clause has been omitted, and this is acceptable when that relative clause can be recovered from the context. This is what a non-truncated version could be:
- "Is it a boy or a girl that she has given birth to?"
A possible declarative clause version of that it-cleft could be:
- "It is a boy/girl that she has given birth to."
A non-it-cleft declarative version could be "She has given birth to a boy/girl".
Here's a related excerpt from the 2002 reference grammar by Huddleston and Pullum et al., The Cambridge Grammar of the English Language, page 1417:
Truncated it-clefts: omission of relative clause
The relative clause of an it-cleft construction can be omitted if it is recoverable from the prior discourse:
A: Who finished off the biscuits?
B: I don't know; [it certainly wasn't me].
The underlined clause [it is 'bracketed' -- f.e.] here can be analyzed as a truncated it-cleft, equivalent to It certainly wasn't me who finished off the biscuits.
In the OP's post, there is this:
"Mary just wrote to tell us that she's back from maternity leave, and I want to congratulate her and ask whether she had a girl or a boy, but I can't do it without calling the child an 'it'!"
I blinked, then confirmed that yes, he believes the it in "Is it a boy or a girl" is the impersonal pronoun, the same word you'd apply to an apple or a house.
From the above context, a third person (or the OP herself) could have asked the boss a non-trunctated it-cleft such as "Was it a boy or a girl that she had?", though that version sounds awkward when compared to the truncated version "Was it a boy or a girl?"
For #2b: In some contexts, the word "it" could be considered to be in an anaphoric relation, where its antecedent is the baby. For instance, if the baby was already the topic of discussion.
Grammatically, the 3rd person singular neuter pronoun ("it") can sometimes be used to refer to a baby. Here is an excerpt from a 2005 textbook by Huddleston and Pullum, A Student's Introduction to English Grammar, page 103:
The neuter pronoun it is used for inanimates, or for male or female animals (especially lower animals and non-cuddly creatures), and sometimes human infants if the sex is unknown or considered irrelevant: The baby grunted again, and Alice looked very anxiously into its face to see what was the matter with it.
The acceptability for either #2a or #2b as an explanation will usually depend on the specific context of the surrounding discourse. That's the way it is in today's standard English -- context is king.
MORE INFO: Perhaps some more general info about the 3rd person singular neuter pronoun ("it"). There are some special uses for it, where those uses for "it" are not anaphoric (or at least not clearly so). These include:
Extrapositional and impersonal it -- e.g. "It's ridiculous that they've given the job to Pat."; "It seemed as if things would never get any better."
The it-cleft construction -- e.g. "It was precisely for that reason that the rules were changed."
Weather, time, place, condition -- e.g. "It is raining."; "It is five o'clock."; "It is very noisy in this room."; "I don't like it when you behave like this."
It as subject with other predicative NPs -- e.g "It was a perfect day."
It in idioms -- e.g. "What's it to you?"; "Beat it, kid"; He made a go of it."
The above info and examples are borrowed from the 2002 CGEL, section "Special uses of it", pages 1481-3.