Hamsters often are fed "junk food" -- human treats that are not good for them -- and the combination of obesity and constipation can make them listless and too sluggish to be able to move around easily. Putting them on a healthy diet and giving them wheels and other exercise equipment can help.
A bladder or kidney infection could cause this. If your hamster is having bloody urine or squealing in pain when urinating this could most definitely be the cause. If this doesn't sound like him then check your bedding to make sure he hasn't gotten a respiratory infection from cedar.
It could be many things: infections, poor diet, broken bone, etc. Take your hamster to an exotics vet (one who specialises in rodents) for a proper diagnosis and treatment options.
It sounds like your hamster might be dying. Often before animals die they have trouble walking and don't have very much energy. Spend time with your rabbit while you can and make it comfortable.