This is another good reason for not using spaces in labels. However, forcing them to be "real spaces" works:
\documentclass[a4paper,12pt,openany]{book}
\usepackage{alltt}
\begin{document}
\begin{alltt}
\pageref{asd\string fgh\string jkl}
\end{alltt}
\label{asd fgh jkl}
\end{document}
Alternative method:
\documentclass[a4paper,12pt,openany]{book}
\usepackage{alltt}
\newcommand{\ttpageref}{\begingroup\catcode`\ =10 \ttpagerefaux}
\newcommand{\ttpagerefaux}[1]{\pageref{#1}\endgroup}
\begin{document}
\begin{alltt}
\ttpageref{asd fgh jkl}
\end{alltt}
\label{asd fgh jkl}
\end{document}
You can also use \pageref
directly, with a more complicated setup:
\documentclass[a4paper,12pt,openany]{book}
\usepackage{alltt}
\let\latexpageref\pageref
\newcommand{\ttpageref}{\begingroup\catcode`\ =10 \ttpagerefaux}
\newcommand{\ttpagerefaux}[1]{\latexpageref{#1}\endgroup}
\usepackage{etoolbox}
\AtBeginEnvironment{alltt}{\let\pageref\ttpageref}
\begin{document}
\begin{alltt}
\pageref{asd fgh jkl}
\end{alltt}
\label{asd fgh jkl}
\end{document}