I've been there before myself, being unmotivated at the gym is the worse. Fortunately, there are definitely ways around it.
Variety is one of the main ways around this. You will almost always get bored in the gym if you are just sitting there doing the same thing over and over again, especially if you don't like working out in the first place. Bland and overused workouts are killer, and I mean that in the bad way. Change up your routine (I can help you with this if you want, I just finished making a two week split and circuit training program for myself, and with some tweaks it works for fat burning).
Try working out with a friend. If you always work out alone, you lack that physical motivation you get from a personal trainer or peer that works out with you. This may seem trivial, but trust me, it gets you past a lot of ruts and plateaus. If none of your friends work out or if for some reason you can't get a buddy in there with you, try hiring a personal trainer.
Keep track of your results. If you keep a training diary and actually record what you do, it gives you a physical representation of your progress, and seeing positive progress and results is probably the most motivating thing. If you work out and never progress and don't get the results you want, there is no gratification in that. You need to see yourself lose weight and see results in order to want to do it more. So, try a training diary, or try taking a picture of yourself every day you work out, like this guy:
[youtube]
http://www.youtube.com/watch?v=J4F6W4DOEBU[/youtube]
Remember, if you need help making a program I'll definitely help you out.