  Let $\M$ be a smooth connected non-compact manifold endowed with a smooth
measure $\mu$ and a smooth locally subelliptic diffusion operator $L$
satisfying $L1=0$, and which is symmetric with respect to $\mu$. We show that
if $L$ satisfies, with a non negative curvature parameter $\rho_1$, the
generalized curvature inequality in \eqref{CD} below, then the Riesz transform
is bounded in $L^p (\bM)$ for every $p>1$, that is \[\|
\sqrt{\Gamma((-L)^{-1/2}f)}\|_p \le C_p \| f \|_p, \quad f \in C^\infty_0(\bM),
\] where $\Gamma$ is the \textit{carr\'e du champ} associated to $L$. Our
results apply in particular to all Sasakian manifolds whose horizontal
Tanaka-Webster Ricci curvature is nonnegative, all Carnot groups with step two,
and wide subclasses of principal bundles over Riemannian manifolds whose Ricci
curvature is nonnegative.
