Well, one of the best examples to look at would be in Act III scene 4, where Polonius hides himself behind the arras so that he can witness the conversation that Hamlet has with Gertrude. This is dramatic irony because we know that the person behind the arras is Polonius, whereas unfortunately, Hamlet does not. Therefore, when he hears Polonius cry for help, he thinks that it is actually Claudius, and believes that he is killing Claudius. His disappointment and shock when he sees the dead body of Polonius instead indicates that clearly revenge is not the best option in this situation. Note the words that Hamlet says to Polonius once he has discovered the identity of the man he has just killed:
Hamlet is forced to realise that his desire for revenge has led him to kill an innocent and not kill the man that he has been trying to kill.