Let $X,Y$ be two proper normal varieties over $k$ (integral separated schemes of finite type over $k$), and a map $K(Y) \to K(X)$. I want to show that this induces a morphism $U \to Y$ where $U$ is an open subset of $X$ such that all points in $X \setminus U$ have codimension at least $2$.
My naive approach would be to consider some affine open of $V \subset Y$ such that $V= \operatorname{Spec}(B)$ with $B=k[x_1,\dots,x_n]/I$ which can be done since our scheme is of finite type over $k$. Then $K(\operatorname{Spec}(B))=K(Y)$ and we can set $\varphi:B \to K(Y) \to K(X)$. Then we note that $$\varphi(x_i)=\frac{a_i}{f_i}$$ Now given an affine open $\operatorname{Spec}(A)=U \subset X$ if we take $g=f_1 \cdots f_n$ our maps necessarily factors through $A_g$ but using this construction I have no control over the codimension of the points not lying in $U$.
I would like to show that I can take some $U$ such that it contains every smooth point of $X$ but how?