I agree 100% with the answers that are telling you to not change and you should be considering a different environment to work in.
However, I'd like to add that there can be various reasons for people not to greet you back:
- They were zoned out and did simply not hear you.
- They did not notice your greeting (sometimes our brain is slow to react, especially if we're zoned out as pointed out in the first point) and sometimes when people eventually figure it out they feel too embarrassed to shout back a greeting; instead they figure the awkwardness they experience will be less if they pretend to not have heard it. Not for the sake of ignoring you but for not appearing awkward.
- They weren't sure if you were greeting them or someone else.
- Some people greet only by nodding their heads or use other kind of a body language, it's possible that you're being greeted without noticing it yourself.
There's always a chance that people are jerks but the likelihood of many people being jerks at the same place at the same time is low, especially in the workplace where people benefit from at least trying. There's always the chance though.
Consider all the factors and make a decision that will make you feel the most comfortable with.
I'd like to suggest that you try to greet people with a very clear voice and make sure you're not mumbling or whispering, to remove all doubt, you don't need to shout but it's easy to say something without the other person clearly hearing what you're saying. Making eye contact should also help to make sure they notice you in the first place.
I'd also like to suggest that you include their name in the greeting, they are more likely to snap out of the zone when they hear their name and when they're 100% sure you were indeed greeting them they're more likely to respond.If you feel like nothing changes then find yourself a work environment that makes you feel good in.
If you are too shy to include the name then simply don't take it personally when people don't respond, there's a huge chance that it has nothing to do with you, they simply did not hear you or when they figured out you were greeting them they turn out to be too embarrassed to respond as I pointed out earlier. Take a note here though, people love the sound of their name, they'll be more likely to like you when you bother using their name. Get into the habit of using it if other people's opinions matter to you. I'm not saying that it necessarily should, though.
You should definitely seek medical help about the depression, however. It's quite common and it's actually a real biological thing, you've got nothing to hide.
To me you sound like the perfect candidate to read Dale Carnegie's How to stop worrying and start living. It's an excellent reading, in my opinion, on how to stop worrying about things I cannot control.
It should give you all the answers you need to how to react to the situation you are fearing the most.
I'm going to give away 2 tips from the book that are demonstrated much better in the book so don't give up on the book or the topics if I fail to demonstrate properly:
Never expect anything from anyone. An example could be: never expect people to say thanks. People are selfish in their nature and self-oriented, it's nothing personal if they don't say thanks. Never expect it and you'll be oddly satisfied when it will happen, instead of hurt when it doesn't happen. A better example, for your case, would be to never ever expect people to greet you, that way you'll accept it as a normal thing (due to various reasons that simply don't matter) so when it does happen you'll perhaps appreciate the gesture but don't take it for granted. This is demonstrated much better in the book but a potential starting point.
Prepare for the worst, accept the worst, for you cannot change it, then hope for the best. Example: let's say you're afraid of losing your job. The worst thing that you think that can possibly happen to you is that you'll lose your job. Can you accept it? Could you survive if you'd lose your job? Either way, accept it. Feel good about it. If you'd lose your job and there'd be nothing you could do about it then there's no reason in worrying about it, for it will drain all of your energy. Once you've accepted the worst possible outcome you can work on doing whatever is in your power to avoid and or prepare for the worst possible outcome. More often than not the worst possible outcome will not come to reality and when it does it will be so much easier to handle once you've accepted it and stress is not a part of it. Stress is pointless if you're being stressed about something you can't possibly change.
This is much better demonstrated in the book, please take a look.
Best of luck, and remember that people are like garbage trucks.