A soliloquy is most likely to be spoken in a play in the following case:
when a character reveals her secret desire to the audience but keeps it hidden from other characters.
This is because soliloquies are typically used to express a character's inner thoughts and feelings directly to the audience, often while they are alone on stage, which sets them apart from monologues (which may address other characters) and dialogues (which involve interaction between characters).