How can I prevent my baby from getting a cold?

It's hard to prevent. You obviously should keep the child from other people with colds and clean things other babies have played with before letting your baby play with it. However, our immune system needs to fight infections to become stronger and you really can't stop it. So prevent what you can but realize that it's going to happen at some point.
Reduce exposure. Colds are a fact of life. Aside from living in a bubble, your child will get them. For the most part, they are harmless and will pass. Avoiding obviously sick people, washing hands, cleaning surfaces and handles, and staying away from populated locations may help reduce the overall viral exposure. Daycares and preschools are considered automatic sick contacts as there are so many viruses.