No, the attorney could not reveal his client's confession or information about where the body is, and certainly would not have to withdraw from the representation. The vast majority of criminal defendants are, in fact, guilty, so a criminal defense lawyer who insisted on representing only innocent people would get hungry pretty fast. My understanding is that defense attorneys discourage their clients from telling them such information, however, and focus on ensuring procedual fairness and getting the lowest possible sentence for a client who is obviously guilty.
This is why I could never be a defense attorney. The ethics are too complex for me lol. I prefer to sleep at night.