Obstruction to the existence of a globally defined integrating factor Let $U$ be an open subset of $\Bbb{R}^n$ and take $\omega$ to be a nowhere-vanishing smooth $1$-form on $U$. The Frobenius Theorem implies that, near each point of $U$, $\omega$ may be written as $g\,{\rm{d}}f$ for suitable locally defined smooth functions $f$ and $g$ iff $\omega\wedge{\rm{d}}\omega=0$. Here is my question(s): For such a $1$-form $\omega$ on $U$ (never vanishing and $\omega\wedge{\rm{d}}\omega=0$) what is the obstruction to the existence of global smooth functions $f$ and $g$ on $U$ with $\omega=g\,{\rm{d}}f$? Can that be formulated as the vanishing of any homotopical invariant of $U$? What is a good non-example in which such a global presentation of $\omega$ fails to exist? 
 A: To expand on my comment: suppose you have $U$ not simply connected, and $\omega$ closed but not exact, and suppose there exists a closed loop $\gamma: [0,1]\to U$ such that $\omega(\dot{\gamma})$ is signed. (This is in particular the case with the "example" in your comment, where you can take $\gamma$ to be any circle centered at the origin.) 
Suppose $\omega= g df$ for smooth $g$ and $f$, then you must have
$$ g \nabla_{\dot\gamma} f $$
is signed. This implies both $g$ and $\nabla_{\dot\gamma} f$ are signed along $\gamma$, but this is absurd, since integrating from $0$ to $1$ you have
$$ \int_0^1 \nabla_{\dot\gamma(s)} f(\gamma(s)) ~ds = f(\gamma(1)) - f(\gamma(0)) = 0 $$
since $\gamma$ is a closed curve. 

Simply-connectedness is not enough, however, to ensure that the integrating factor can be globalized. To see this, recall that Frobenius theorem states that the nonvanishing one-form $\omega$ satisfies $\omega\wedge d\omega = 0$ IFF its kernel is the tangent bundle of a regular foliation. 
If $\omega = g ~df$ for some function $f$, then necessarily $f$ will be constant on the leaves of this foliation. Hence a counterexample will be found if you have a regular foliation of a simply connected compact manifold. (As on a compact manifold the function $f$ must attain a maximum and $df = 0$ there, contradicting the assumption that $\omega$ is non-vanishing.)
One such example is given by the Reeb foliation of the 3-sphere. 
If we want to examine domains in Euclidean space: embed $\mathbb{S}^3 \hookrightarrow \mathbb{R}^4$ and slightly thicken it radially by $\epsilon$. Define a foliation on this 4 dimensional (simply-connected) domain by extending the Reeb foliation trivially in the radial direction. The lifted one-form $\tilde{\omega}$ is the pull-back of the Reeb $\omega$ from $\mathbb{S}^3$ by radial projection, and hence $\tilde{\omega} \wedge d \tilde{\omega} = 0$. Any $\tilde{f}$ that realizes $\tilde{\omega} = \tilde{g} d\tilde{f}$ will be constant on the foliation, and hence factors through some $f$ on $\mathbb{S}^3$, and the argument above shows that this contradicts the fact that $\omega$ is non-vanishing. 
