If you look at the docstring of
whitespace-mode (emphasis mine):
whitespace-mode is an interactive autoloaded compiled Lisp function in
(whitespace-mode &optional ARG)
Toggle whitespace visualization (Whitespace mode).
The elisp manual section on autoloading begins with:
The autoload facility lets you register the existence of a function or macro, but put off loading the file that defines it. The first call to the function automatically loads the proper library, in order to install the real definition and other associated code, then runs the real definition as if it had been loaded all along.
So in this case, although the function
whitespace-mode is visible, the
whitespace library is not loaded and so variable
whitespace-style is not defined. You can autoload the library by invoking function
whitespace-mode, for example with