Hamlet is talking about the unbearable nature of existence and the feeling of being trapped in a imperfect, physical body (in an imperfect physical world)
He wants to escape his body and the dirty, bloody mess of life. So he wishes that his body would melt and thaw like ice and become pure and clean like fresh morning dew.
There is an on-going argument about the text for this quote. Some early versions of Hamlet are,
"O that this too too sullied flesh would melt"
and some are
"O that this too too solid flesh would melt"
('sullied' means dirty and corrupt.) Either way, Hamlet wants to leave the dirty physical world and become pure spirit.
This quote if from Hamlet Act I Scene II where Hamlet for the first time in the play thinks of suicide.He thinks that its better that this solid flesh should melts to dew which means that eitheot body should come to an end by itself or else God should not have made suicide , a crime.One should be allowed to commit suicide and it should not be considered a crime. He is very depressed and distressed because of his mother's re-marriage to his uncle.There is an internal conflict going on in hs mind.he is not able to accept his ac of his mother when he thinks that this is the same woman who was crying like Niobe and its not even a month that she marries his uncle.He wants to die and end his life because he feels he is born from such a womb.There is a hatred in his heart for women now.He is in great pain here for two reasons: one is his father's death whom he respected very much and second his mother's re-marriage just after his father's deathIn such state of mind Hamlet is not able to take interest in anything and all the things and works of the world seems useless and unprofitable to him.In such depressed state he just want to move away from such world.