I have a nice research idea whose proof hinges on the following question

> Suppose $X_p$ and $Y_p$ are vector fields in $\mathbb{R}^3$ with $[X,Y]_p=0$ for all $p$ in some closed set $K\subset\mathbb{R}^3$. For each point in $p\in K$, does there a neighborhood $U$ of $p$ and a two dimensional foliation $\mathcal{F}$ on $U$ with the property that $T_qL_q=\text{span}(X_q,Y_q)$ for each $q\in U\cap K$? Here $L_q$ denotes the leaf of $\mathcal{F}$ through $q$.

At a first glance, I thought this was probably true: after all, if such a foliation existed, then the vector fields _must_ commute on $K$. But the more I try and prove it, the more I am having second thoughts on whether this is true.

My naive attempt at a proof involves mimicking the proof of the Frobenius theorem; i.e. my candidate for the foliation would be the coordinate change
$$
(t_1,t_2,t_3)\mapsto\theta_{t_1}\circ\psi_{t_2}(0,0,t_3),
$$
where $\theta_t$ and $\psi_t$ denote the flows of $X$ and $Y$ respectively, but the details get a little hairy when the vector fields don't always commute.

I imagine that this has been studied before, so I was hoping someone would know of a reference that studies this question. If this is not true in general, what additional hypotheses are required?

Any help would be greatly appreciated. Thanks in advance.