When you say
\read<number> to \foo when the number doesn't correspond to an open input stream and the number is nonnegative, TeX will prompt you with
The stream cannot be open if the number is greater than 15, so any integer from 16 up is good. If you use a negative number, the prompt is not shown, but TeX will wait for input nonetheless.
There's the problem of the trailing space, which comes from the end-of-line you insert by hitting Return. This can be solved by setting the end-of-line character to have category code 9.
\catcode`\^^M=9 % ignore the end-of-line
\read 20 to #1%
The console output is
In the first line TeX prompts for
\foo; I typed in
xyz and Return. The output of
\show tells us that there is no space. The grouping confines the change of category code. With the chain of
\expandafter we are able to define
\foo also outside the current group before closing it.