When some one brings up something sad or bad that has happened is "I'm sorry to hear that" or "Don't worry, it will get better" really enough of a response?
You ask a very important question, because we all have occasion to hear other people's announcements of bad news. Expressing some sympathy is better than doing nothing, and is (if my experience is any guide) comforting to the person who announced the bad news. Among my several hundred Facebook friends (many of whom I know mostly via common subscription to email lists discussing parenting issues), there are friends who I don't know WELL, and whom I am unable to give any practical help, who nonetheless seem to appreciate me saying things like "Get well soon" or "I hope you get over that in a while" or even just "That's rough." Just acknowledging a fellow human being's common trouble from being part of the human condition seems to help somewhat. Perhaps I haven't given you a great deal of practical help by this reply, but I did want to reply to acknowledge that you are grappling with a tough problem.
When saying those things in-person it matters how you say it just as much as what you say.
Sometimes, if it is a co-worker that you don't talk much with, and it feels a little too awkward to say "sorry for you loss", it might be easier to offer to take some work off of them or help them with something else. Stuff like "I noticed you have this bug in your queue, assign it me if you like".
You ask a very important question, because we all have occasion to hear other people's announcements of bad news. Expressing some sympathy is better than doing nothing, and is (if my experience is any guide) comforting to the person who announced the bad news. Among my several hundred Facebook friends (many of whom I know mostly via common subscription to email lists discussing parenting issues), there are friends who I don't know WELL, and whom I am unable to give any practical help, who nonetheless seem to appreciate me saying things like "Get well soon" or "I hope you get over that in a while" or even just "That's rough." Just acknowledging a fellow human being's common trouble from being part of the human condition seems to help somewhat. Perhaps I haven't given you a great deal of practical help by this reply, but I did want to reply to acknowledge that you are grappling with a tough problem.