Sadness/feeling being blue is like flu. People can catch it like a virus. If a person sees another person who suffers from depression, there's a negative effect on him and he could get sad as well. If you really wanted to avoid being sad, train your consciousness to be happy. Tell yourself you are happy and subconsciously you will. If you see anyone with sadness, try to be an optimist around them, because as sadness feels like a flue, happiness is a positive viral thing too. Spread love, spread happiness. Be the origin of other's happiness, break their sadness and you will see.
I agree, happiness should also not be dependent on others. Meditation helps in my opinion.