unguy, I agree workplace politics can be so frustrating. Many times the workplace is a popularity contest that has little or nothing to do with job quality. If you feel you can't cope in the popularity contest, I think you would be well served to try and find someplace where you can find some sense of satisfaction in your quality of work.
I am not a popular person by nature, I cannot compete in that arena; my personality IRL is too intense. But I am have focused on doing the best quality work I can do and being someone my boss can lean on and rely on.