TITLE: Lie algebra preserving ideal of functions
QUESTION [7 upvotes]: Let $G$ be an algebraic group acting on an affine variety $X=\operatorname{Spec}A$ (all over $\mathbb{C}$).  This gives an action of $G$ on the $\mathbb{C}$-algebra $A$, and an action of the Lie algebra $\mathfrak{g}$ of $G$ on $A$ by derivations.
If the action is not transitive, then $G$ will preserve some nontrivial ideal of $A$ (namely take an ideal of a closed $G$-orbit).  In particular, $\mathfrak{g}$ will preserve this ideal.
My question is whether this remains true if we only have the lie algebra and no group action.  In particular, suppose that $\mathfrak{g}$ is a finite-dimensional Lie subalgebra of $\operatorname{Der}_{\mathbb{C}}(A)$, and suppose that it does not act 'transitively' on $X$, i.e. for some closed point $x\in X(\mathbb{C})$ the natural map
$$
\mathfrak{g}\to T_xX
$$
is not surjective, where $T_xX$ is the tangent space of $X$ at $x$.  Then, must there exist a non-trivial ideal $I$ of $A$ which is preserved by $\mathfrak{g}$?  Feel free to assume $X$ is smooth, say.  Note I am not assuming the action of $\mathfrak{g}$ on $A$ is integrable, else we could use the statement about group actions stated initially.

REPLY [6 votes]: A counterexample is $X=\mathbb{A}^2\backslash\{y=0\}$, $A=\mathbb{C}[x,y,y^{-1}]$, and $\mathfrak{g}$ the span of the derivation $D(x)=1$, $D(y)=y$. Now $\mathfrak{g}$ is $1$-dimensional and $X$ is $2$-dimensional, so the map $\mathfrak{g}\to T_x X$ is not surjective for any $x\in X(\mathbb{C})$. The integral curves of (the vector field associated with) $D$ are $y=ce^x$ for $c\in\mathbb{C}^\times$, 
 and the intuition is that because each of these curves is Zariski dense, there cannot be a non-trivial ideal preserved by $D$. I'm a little confused about how to formalize this argument, especially because an ideal might not be reduced (maybe someone else sees how to do this). I will argue directly that there is no non-trivial ideal $I\subset A$ with $D(I)\subset I$.
Suppose $I\neq (0)\subset A$ satisfies $D(I)\subset I$. Let 
$$
f(x,y)=\sum_{n=0}^m f_n(x) y^m\in\mathbb{C}[x,y], \,\,f_m\neq 0
$$
be an element of $I\cap \mathbb{C}[x,y]$ for which $m$ is minimal, and for which $\deg(f_m(x))$ is minimal (among those elements with minimal $m$). Then
$$
mf-D(f) = \sum_{n=0}^m \big((m-n)f_n - f_n'\big)y^n\in I.
$$
The coefficient of $y^m$ in the above element is $-f_n'$, which has degree less than that of $f_n$, so by the construction of $f$ we must have $mf-D(f) = 0$. Looking at the coefficient of $y^0$, we see $m f_0= f_0'$. This can only happen if either $f_0=0$, or if $m=0$ and $f_0$ is constant. If $f_0=0$, then $y^{-1} f\in I\cap\mathbb{C}[x,y]$ contradicts the minimality of $f$. If $m=0$ and $f_0$ is constant, then $f$ is a constant, and $I=A$.