Please explain the representation of marriage in Hamlet?
I'm afraid Shakespeare's Hamlet is a product of a male-dominated society. As enlightened as Shakespeare was in so many ways, his presentation of women, at least in Hamlet, is extremely sexist, and that deals directly with his presentation of marriage.
Gertrude is at the least full of and driven by her lust, gullible, and foolish. King Hamlet appears to have truly loved her before (and after, for that matter) his death, and is extremely forgiving toward her, telling Hamlet repeatedly to leave her out of his plan for revenge and to not blame her. Yet, she remarries within two months of his death. She also, by the way, is allied with Claudius throughout the play, far more often than she is allied with her son. Her marriage with Claudius seems to be dominated by sex, at least from Hamlet's point of view. This focuses her attention on her marriage, rather than on her role as mother.
The other female central to the action is Ophelia. Marriage is referenced early in the play when she is warned that Hamlet cannot be serious about pursuing a relationship with her, because she is not of noble blood. The idea is that Hamlet, a prince, would be expected to marry a person of royalty for political reasons.
Hamlet does appear to have loved Ophelia, however, but turns against her when she spies on him for her father and King Claudius. Hamlet berates and humiliates her, and uses her as she attempted to use him. Though Hamlet and Ophelia are not married, there is some evidence that Ophelia is pregnant with Hamlet's child, which specifically makes their relationship relevant to your question.
In short, marriage is a flawed institution in the play, due mostly to inherent weakness in the female gender.
If you look further at marriage and specifics, you could argue that marriage is a flawed institution because it hasn't worked. While the queen was not divorced from her husband, she really had no idea what was going on in her marriage with King Hamlet. When Hamlet presses after killing Polonius, she acts as if she never even considered that her husband could have been murdered. Further, we never hear anything of Polonius's wife/Laertes and Ophelia's mother. She may have died, sure, but the key factor is Polonius's and Laertes comments to Ophelia, like dstuva says. There's a political element to their comments - that's what they're mostly about. But there's never any mention of the fact that maybe Ophelia does love Hamlet. It's simply out of the question.