A: You have such a beautiful baby! He looks very well.
B: Yes, unfortunately he gets a lot of colic. He doesn't sleep well.
A: Oh, What a shame! (What a pity; How unfortunate!)
Here's another example:
"Nice legs! Shame about the face."