I've been in situations where I've been on the other side of the table to this, and lost developers 'cos they got a better offer. I've been as mad as hell about it, not because they've walked, but because I took my eye off the ball for long enough for the problem to develop...the irritation was with myself, not the guy walking. As it happens, the one guy I lost that I _really_ didn't want to was back 12 months later - when he and I finally worked out the issues that he'd been suffering in the first place.
The first thing I would do is wander into your boss' office, shut the door and have an off-the-record conversation with him/her. Explain the issues and tell them why you're considering moving and what needs to change. Be careful to phrase this as a "We have a problem, how can we work to solve it?" conversation rather than a "I'm leaving unless you fix these problems" conversation otherwise it sounds like blackmail. The fact is, you do feel some loyalty and obligation to your company and/or co-workers....so give that some rope and see what happens.
If the company you're working for has any sense and if you're any cop (and your boss is worth his salt), then they'll find a way to work with you to make you comfortable to stay. If not, or if you don't feel you even have the kind of relationship where you can have that closed door chat, then walk, you're losing nothing.
Note that opinions and attitudes to work vary widely across the world; you'll hear the mercenary "Do what's best for your money" at one extreme and the "Stay, it can't be that bad" at the other. The fact is that you have to do what's right for you, but you should always be able to look your ex-colleagues and bosses in the eye when you meet them in the pub later...
Quite happy to chat further on this if its useful, but