  Let $K$ be an arbitrary field of characteristic zero and $A$ a commutative
associative $ K$-algebra which is an integral domain. Denote by $R$ the
fraction field of $A$ and by $W(A)=RDer_{\mathbb K}A,$ the Lie algebra of
$\mathbb K$-derivations of $R$ obtained from $Der_{\mathbb K}A$ via
multiplication by elements of $R.$ If $L\subseteq W(A)$ is a subalgebra of
$W(A)$ denote by $rk_{R}L$ the dimension of the vector space $RL$ over the
field $R$ and by $F=R^{L}$ the field of constants of $L$ in $R.$ Let $L$ be a
nilpotent subalgebra $L\subseteq W(A)$ with $rk_{R}L\leq 3$. It is proven that
the Lie algebra $FL$ (as a Lie algebra over the field $F$) is isomorphic to a
finite dimensional subalgebra of the triangular Lie subalgebra $u_{3}(F)$ of
the Lie algebra $Der F[x_{1}, x_{2}, x_{3}], $ where $u_{3}(F)=\{f(x_{2},
x_{3})\frac{\partial}{\partial x_{1}}+g(x_{3})\frac{\partial}{\partial
x_{2}}+c\frac{\partial}{\partial x_{3}}\}$ with $f\in F[x_{2}, x_{3}], g\in
F[x_3]$, $c\in F.$ In particular, a characterization of nilpotent Lie algebras
of vector fields with polynomial coefficients in three variables is obtained.
