HAMLET Where’s your father?
OPHELIA At home, my lord.
HAMLET Let the doors be shut upon him that he may play the fool nowhere but in’s own house. Farewell.
OPHELIA [aside] O help him, you sweet heavens!
HAMLET If thou dost marry, I’ll give thee this plague for thy dowry: be thou as chaste as ice, as pure as snow, thou shalt not escape calumny. Get thee to a nunnery. Farewell. Or, if thou wilt needs marry, marry a fool, for wise men know well enough what monsters you make of them. To a nunnery go, and quickly too. Farewell. (3.1.129-139)
Hamlet’s suspicious, either suddenly—there might have been a noise—or finally giving in, long aware that he and Ophelia are being watched and overheard. Where’s your father? Ophelia doesn’t have any choice but to lie: at home, my lord; but of course Hamlet knows or suspects she’s lying, and takes the opportunity to score another point, mostly for Polonius’s benefit. Let the doors be shut upon him that he may play the fool nowhere but in’s own house. He’d better stay there, then, and stop annoying everyone else, and making an idiot of himself too. Farewell. (But he doesn’t go, or at least not far.)
Ophelia’s aghast, but apparently all she can think of is to pray for Hamlet (wet/kind/virtuous/selfless, delete as appropriate): O help him, you sweet heavens! please, restore him to himself! He’s completely lost it now. But no chance for her to recover, Hamlet’s back for another go. If thou dost marry—not me, he’s implying, bitterly—I’ll give thee this plague for thy dowry, what amounts to a curse. Have some of this then, to give your new husband. Be thou as chaste as ice, as pure as snow, thou shalt not escape calumny. It doesn’t matter what you do, how immaculately you behave, how unimpeachable your sexual conduct—what matters is what’s said about you, and it’ll be vile. Your name, your reputation will be mud. So get thee to a nunnery. Farewell.
And again, Hamlet can’t go. Or, if thou wilt needs marry, marry a fool, for wise men know well enough what monsters you make of them. Or maybe you’ll cuckold your future husband anyway, so, marry a man too stupid to know that. Go on, to a nunnery go, and quickly too. Damned if you do, damned if you don’t. Farewell. But even with that savage, incoherent, self-loathing, misogynist, misanthropic parting shot, Hamlet still can’t leave her.