A soliloquy would most likely be spoken in a play in the case of "when a character reveals her secret desire to the audience but keeps it hidden from other characters."
This is because a soliloquy is a speech delivered by a character alone on stage, expressing their inner thoughts and feelings directly to the audience, which fits the scenario of revealing a secret desire. In contrast, monologues and dialogues typically involve communication with other characters.