Generalizing @Sasha's example.
Let $X$ be a regular projective scheme over a noetherian ring $A$, and let $Z$ be a closed subscheme of $X$ of codimension $\ge 3$. The ideal sheaf $I_Z$ is generated by sections after tensoring by $O_X(l)$ for some $l \gg 0$, it follows that we have an exact sequence $$ 0 \to E \to O_X(l)^m \to O_X \to O_Z \to 0 $$ for some $m$ large. If $U \subset X - Z$ is any open subset whose complement is of codimension $\ge 2$, then $E|U$ is locally free but does not extend to the whole of $X$, or to any open set containing an associated point of $Z$.
For any $x\in X$, the ring $O_{X,x}$ is regular and thus the module $E_x$ is of finite projective dimension. For module with finite projective dimension, being a second syzygy is equivalent to being reflexive. It follows that $E_x$ is reflexive for all $x\in X$ and thus $E$ is reflexive. Clearly $E$ is locally free on $X-Z$.
Let $z$ be an associated point of $Z$, then we claim $E_z$ is not locally free at $z$. The module $O_{Z,z}$ has finite projective dimension pdim $O_{Z,z}$ = depth $O_{X,z}$ - depth $O_{Z,z}$ by the Auslander-Buchsbaum formula. Since $z$ is an associated point of $Z$, we have depth $O_{Z,z} = 0$. Since Z has codimension $\ge 3$, and $O_{X,z}$ is Cohen-Macaulay, we conclude that pdim $O_{Z,z}$ = depth $O_{X,z}$ = dim $O_{X,z} \ge 3$. It follows that $E_z$ cannot be free, otherwise $$ 0 \to E_z \to O(l)^m_z \to O_{X,z} \to O_{Z,z} \to 0 $$ would be a free resolution of $O_{Z,z}$ of length 2.
On a scheme satisfying (G1) (Gorenstein in codimension one) and Serre's condition (S2), e.g. normal, Cohen-Macaulay, regular, etc., a reflexive sheaf admits a unique extension from an open set whose complement has codimension $\ge 2$ to the whole space.