\mathbb{Z} yields undefined control sequence error

Load the amsfonts package, this provides that command:

\documentclass{article}
\usepackage{amsfonts}
\begin{document}
$\mathbb{Z}$
\end{document}

Optionally you could load amssymb, as this in turn loads amsfonts.

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$\mathbb{Z}$
\end{document}

For reference, the Comprehensive LaTeX Symbol List has also a table of mathematical alphabets, and the packages required for using them. In the current version (dated 25 June 2020) of the document, it is table 316 with the caption Math Alphabets. It is the final table in chapter 3 Mathematical symbols.