That's literally what a Glycocalyx, of bacteria, is.
It's a network of polysaccharides (sugars) that project from cellular surfaces, such as bacteria. It serves to protect the bacterium by creating capsules, or allows the bacterium to attach itself to inert surfaces (like teeth or rocks), eukaryotes and even other bacteria! Their glycocalyxes can fuse together to envelop the colony.
There are two kinds of glycocalyxes. A distinct, gelatinous glycocalyx is called a Bacterial Capsule while an irregular, diffuse layer is called a Slime Layer.
References: http://en.wikipedia.org/wiki/Glycocalyx http://student.ccbcmd.edu/courses/bio141/lecguide/unit1/prostruct/glyco.html
Glycocalyx are made in cells and excreted to the cell surface, thus, they can be found just outside the cell wall of a bacterium. Being viscous (sticky), it helps in the formation of biofilms such as a coating on inert surfaces like catheters, teeth or rocks. This helps it in colonization as it resists flushing. Glycocalyx also helps protect bacteria from phagocytes (white blood cells), one way in which it does that is the resistance of phagocytic engulfment .
These traits increase the bacterium's virulence.