This will hold for CW structures on manifolds coming from handle decompositions, e.g. induced by a Morse function. Complex line bundles on $X$ are classified by the homotopy class of maps to $\mathbb{CP}^{\infty}$, by pulling back the canonical line bundle $\gamma(\mathbb{CP}^\infty)$. Also, $\mathbb{CP}^\infty = K(\mathbb{Z},2)$, so $\pi_i(\mathbb{CP}^\infty)=0, i > 2$.
Now, consider a line bundle $L$ on $X$ a manifold with a handle structure, such that $L$ is trivial on $X-Y$, where $Y$ is contained in the codimension 3-skeleton. Flipping the handle structure over (so that $k$-cells become $n-k$ cells), we get a handle structure on $X$ in which the line bundle is trivial on the $3$-skeleton (whose handles correspond dually to handles in $X-Y$). The line bundle $L$ is induced by a map $X\to \mathbb{CP}^\infty$ which is trivial on the $3$-skeleton, and hence may be homotoped to be constant on the 3-skeleton by homotopy extension. Then we may homotope each $i$-cell, $i>3$, to be trivial inductively using the fact that $\pi_i(\mathbb{CP}^\infty)=0$, until we have homotoped it to a trivial map. So at least this works for handle structures on manifolds.
Addendum: For the case of general CW complexes this will be false. For example, take a non-trivial line bundle over $S^2 \vee S^5$. Then it will be non-trivial over $S^2$ and trivial over $S^5$, since again $\pi_5(\mathbb{CP}^\infty)=0$. However, this line bundle is trivial on the complement of the codimension-3 skeleton which is $S^2$.