Is your rat eating and drinking normally? It may be that your rat had become dehydrated and is now constipated. You can do a number of things to help your rat if this has been going on for more than a day. For immediate first-aid you should try to feed green leafy vegetables, bananas, and blueberries if you have any of these. Give plenty of water-- with a needle-less syringe if necessary. You should see a vet that has experience treating exotic pets as soon as you can.

It is possible that your rat has a simple case of constipation or has eaten something that is blocking his intestinal tract or has megacolon. Megacolon is a condition where the nerves to the large intestine don't work well and the rat has trouble moving his bowels. The colon becomes baked up with feces and the stool becomes larger than normal-- also dries out causing trouble passing stool and severe bloating. This condition has been showing up lately in some lines of baby rats (usually noticeable by four weeks of age). There is a treatment that works-- suppositories, enemas, fluid therapy, change in diet (higher fiber and moisture), gentle abdominal massage and finally the drug Cisapride at 0.2-0.4 mg/lb. This treatment should be monitored by a knowledgeable vet. If you decide that megacolon is what is causing the constipation, there is a very good article on it here:
<http://www.rodentfancy.com/myomorpha/bloat.htm>.