When to and when not to do yoga
For just about every other condition do yoga. Some conditions require the assistance and guidance of a more qualified teacher that you will need to seek out, such as cancer patients, pregnancy, rehabilitating an injury, or coming back from a surgery. Take time to look up the most qualified Iyengar Yoga Teacher in your area for these concerns.
But, if you have a cold, sore neck, old injury, or a mental disorder such as depression, get on your yoga mat. Some times that is easier said than done. I can attest to that, it is much more comfy to sit on my couch and read about yoga than to practice when I hurt or when my depression is really acting up, but I have to remind myself that even starting with a 15 minute practice will make me feel better, and hopefully will turn into a full practice.
Each yoga pose has therapeutic benefits. A well trained teacher can guide you to the poses that you need for your specific needs, and a well practiced practitioner has experienced and learned them enough to establish a sequence at home to create the needed benefits for their own body.
So unless you have a fever, stay on your mat and practice your body will thank you.