Let $X$ be an integral Noetherian scheme. If $Z \subset \mathbb{P}^n_{\mathbb{Z}}$ is a closed subscheme, under what conditions can we say that the codimension of $X \times Z \subset \mathbb{P}^n_X$ is equal to the codimension of $Z \subset \mathbb{P}^n_{\mathbb{Z}}$? I am really interested in the case that $Z$ has codimension one, i.e. $Z$ is a Weil divisor on $\mathbb{P}^n_{\mathbb{Z}}$.
Edit: this is not always true. If the subscheme is of an "arithmetic" nature, e.g. $\mathbb{P}^n_{\mathbb{F}_p} \subset \mathbb{P}^n_{\mathbb{Z}}$, then the result depends very much on the characteristic in which $X$ lives.