This is a little perverse, but rather than answering the question, I want to explain what can go wrong when attempting to construct an example. This is the sort of thing one never does normally so I think it's kind of interesting.
If $X$ is a smooth curve, then any vector bundle $E$ on an open set $U$ extends. To see this, we can assume after shrinking $X$, that $E$ is trivial. Then it can be extended to a trivial bundle (the extension is not unique).
If $X$ is smooth surface, then any vector bundle $E$ on an open set $U$ extends. (I think that Olivier Benoist's answer contains a very nice idea, but I don't think the conclusion is OK.) To simplify the argument, assume that $X-U=\{p_1,p_2\ldots \}$ is zero dimensional. We can find finitely sections in a neigbourhood $V$ of $p_i$ which generate $E^*$. This yields an inclusion $E|_V\hookrightarrow \oplus \mathcal{O}_V^n$, and therefore $j_*E|_V \hookrightarrow\mathcal{O}_X^n$, where $j:U\hookrightarrow X$ is the inclusion. It follows easily, that $j_*E$ is coherent. Therefore $F=(j_*E)^{**}$ is a reflexive extension of $E$. However, reflexive sheaves have depth 2. Since by Auslander-Buchsbaum-Serre depth+proj.dim=2 in $\mathcal{O}_{p_i}$, we can conclude that $F$ is in fact locally free.
In view of jvp's answer, we see that 2 does not hold in the analytic category.
One might seek a topological obstruction involving Chern classes as in David Treumann's comment, however: Claim: Any Chern class on $U$ extends to $X$, where $X$ is a smooth partial compactification. Proof: With a bit of fiddling one can see that $c_p(E)$ would lie in $W_{2p}H^{2p}(U,\mathbb{Q})=im H^{2p}(X,\mathbb{Q})$ by Deligne, Theorie de Hodge II, III