The short answer to this is that Hester refuses to tell who the child's father is. This can be found in Chapter 3.
She is told that naming the father will take the weight off her conscience. She says that it will not. She will always bear the weight and she might as well bear the father's guilt too.
She is told that she should "give the child a father." In response to this, she say that the only father the child will have is her heavenly father -- she will never know an earthly one.
Although Hester does not say so, it is later revealed that she holds on to her secret because she loves Dimmesdale and wants to protect his reputation.
In Chapter 17, Hester meets Dimmesdale in the forest. She tells him:
"Truth was the one virtue which I...did hold fast...save when thy good,---thy life,---thy fame,---were put in question! Then I consented to a deception."
In other words, when she had a chance to reveal the identity of the man with whom she had sinned, she refused, in order to save that man's life and reputation.
In retrospect, Hester regrets her deception: "But a lie is never good, even though death threaten on the other side!" Dimmesdale, in fact, feels that his ordeal---of suffering in secret---has been worse than Hester's public shame.