There are many things to look into - as there was not a lot of information I will suggest a few fundamental things to check first.
Temperature - check temperatures with thermometer or raytek, just because the dial says 35degrees does not mean that is the temperature inside the enclosure.
Bearded dragons want a spot at least 35degrees to get nice and warm.
Is your animal spending enough time in the warm part of the cage?
Is the enclosure too humid - your lizard could have pneumonia if it has been cool and moist.
do you have UV - is it old or new, remember change every 6 months. Is the UV at the opposite end to the heat? Is the UV being filtered out by glass or plastic?
Is it feeling intimidated by another animal in the room, dragons have good eyesight and are very good at psychological bullying.
Last of all have you been feeding it mealworms? Might have a tummy pain, try some warm water therapy, the little bearded's cannot digest mealworms and they can compact in their stomach, can cause death.