They happen. No one plans on being sick or getting injured.
Since having my daughter I've had a lot more set backs in training and racing than I anticipated. Between not being able to workout because she's sick, missing a workout because I caught her cold, missing a race because I was up the entire night with her for one reason or another... Life is unpredictable, especially with kids.
It's incredibly frustrating when you have a setback. Take a deep breath and roll with it. Time passes and things change. When sick or injured it's better to take a break and then slowly get back to it than keep pushing on and make yourself worse. There will be other training days and other races.
I had a big goal for my A race during running the running season. I didn't hit it and was frustrated. Between not enough sleep, little one waking me up several times during the night... not having someone to watch her when she's sick... having colds (never use to get sick before having a kid)... but I still managed to have a pretty good PR. Our family has been passing colds back and forth for the past few months so looks like the beginning of tri season isn't going to be what I wanted it to be. I take a deep breath and go with it. Adjust my goals and work with what's going on.
Having a balanced life also helps. The triathlon lifestyle is rewarding, healthy, and exciting... but it can't be the end all be all in your life. Even pros need balance. Have other hobbies, spend time with your friends and family, enjoy other activities outdoors. I know it's hard to make the time for other things when you are working full time, training, and have a family. Even if it's just once a week you make time for another hobby whether it's baking, reading, painting, etc if it's once a week or once a month it counts.
I love doing yoga. It's a very good companion to triathlon training. My daughter also loves it. It's a good way to spend quality time with your kids and spouse if you can get them to join in. Reading is another one of my passions. I use the time after my daughter goes to bed to read a little bit.
Whether it's kids schedules, colds, injuries, etc. what ever sidelines training or racing it's frustrating. Just remember life isn't easy but your attitude and how you handle adversity makes all the difference. Smile and take a deep breath.