COSMOGRAIL: the COSmological MOnitoring of GRAvItational Lenses. III. Redshift of the lensing galaxy