I believe the answer is: sympathy
Sympathy is a form of emotion that make us feel sorry if bad things happen to another individuals.
This emotion could be conveyed through verbal method (such as saying the sentence above) or non verbal method (such as wearing black dress in a funeral)