Personally, I think that it's impossible to completely avoid getting a cold or flu. Exercise, diet, etc can, however, lesson the effects.
I tend to drop my working hours to maybe one or two so I can deal with any critical stuff and then rest as much as possible. I've found that shortens the shortens the length of illness considerably compared to trying to work through it. I'd rather have a few days of no productivity than have a linger sickness screw it over.