Let $X$, $Y$ be connected smooth schemes of finite type over an algebraically closed field of characteristic $0$. Let $f:X\rightarrow Y$ be a non-birational morphism surjective on the underlying topological spaces. Can the non-flat locus of $f$ be non-empty of codimension$\geq 2$ in $X$? For birational morphism, I belive ZMT plus a purity theorem show that the answer is "no".
P.S. This question was posted on math.stackexchange 3 days ago but there was zero reaction so far.