Line bundles trivial outside of codimension 3 Let $X$ be a CW complex (possibly a topological/smooth manifold) of dimension $n$, $L\to X$ a complex line bundle and $Y\subset X$ a subcomplex (possibly a submanifold) contained in the codimension 3 skeleton of $X$, such that $L$ is trivial on $X-Y$. Is it true in this case that $L$ is trivial on the entire $X$? 
This holds obviously for holomorphic line bundles on smooth varieties, in which case it corresponds to complex codimension 2, but I'd like to be able to replace holomorphic by smooth or continuous.  
 A: 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$. 
A: Here is a (slightly) alternative approach in the smooth case.  Assume the embedding $Y \to X$ has codimension at least three, where $Y$ is a closed smooth manifold. 
What we need to know is that the inclusion $
X-Y \to X$ is at least $2$-connected.
This exercise is an easy consequence of transversality, using the codimension $\ge 3$ hypothesis.
Isomorphism classes of line bundles over $X$ are classified by homotopy classes of maps $X \to \Bbb CP^\infty$.  I.e., they're in bijection with $H^2(X;\Bbb Z)$, where the trivial class corresponds to the trivial bundle.
But the map $H^2(X;\Bbb Z) \to H^2(X-Y;\Bbb Z)$ is injective by the Hurewicz theorem and the long exact sequence of a pair (since $X-Y\to X$ is $2$-connected, we have $H^2(X,X-Y;\Bbb Z)=0$). By hypothesis the class of $L$ in $H^2(X;\Bbb Z)$ pushes forward to a trivial class in $H^2(X-Y;\Bbb Z)$, so it follows that $L$ is trivializable.
(More generally, for a subcomplex $Y \to X$, your conclusion will hold whenever $Y-X\to X$ is $2$-connected.)
