Let $k$ be a field, let $X$ be a smooth quasi-projective $k$-variety, let $Z\subset X$ be a closed subscheme of codimension at least $2$, it is [shown](https://projecteuclid.org/euclid.dmj/1558145274)
 that the restriction map $\mathrm{H}^2(X,\mathbb{G}\_m)\to\mathrm{H}^2(X-Z,\mathbb{G}\_m)$ is an isomorphism. 


Let $\mathcal{X}$ be a smooth Deligne-mumford stack over $k$, let $\mathcal{Z}$ be a closed substack of codimension at least $2$, does it still hold that $\mathrm{H}^2(\mathcal{X},\mathbb{G}\_m)\to\mathrm{H}^2(\mathcal{X}-\mathcal{Z},\mathbb{G}\_m)$?



Purity of Brauer group for stacks
The answer seems to be positive and actually at least in the context of regular (locally) noetherian Deligne--Mumford stacks. (Actually, Artin stack should also be enough as we can compute the Brauer group also as the fppf-cohomology of $\mathbb{G}\_m$.)


Let $p\colon X \to \mathcal{X}$ be an \'etale cover. We obtain a descent spectral sequence


$$H^i(X^{\times\_{\mathcal{X}}j}; \mathbb{G}\_m) \Rightarrow H^{i+j}(\mathcal{X}; \mathbb{G}\_m).$$


Likewise we obtain a spectral sequence


$$H^i((X-p^{-1}(\mathcal{Z}))^{\times\_{\mathcal{X}}j}; \mathbb{G}\_m) \Rightarrow H^{i+j}(\mathcal{X}-\mathcal{Z}; \mathbb{G}\_m).$$


As \'etale maps are smooth of relative dimension zero, $X - p^{-1}(\mathcal{Z})$ has still codimension at least $2$ in $X$ and likewise for all higher fiber products. Moreover, under your regularity hypotheses purity also holds for the group of units and for the Picard group. Thus, the map $\mathcal{X} - \mathcal{Z} \hookrightarrow \mathcal{X}$ induces an isomorphism of $E\_2$-terms of spectral sequence for $i\leq 2$ and all $j$. Thus, it also induces an isomorphism on convergenda for $i+j\leq 2$, which is exactly the statement we want. 


