I’m not sure if I understand you correctly, but a the whitespaces shouldn’t be part of your vocabulary. Whitespaces only separate words/tokens, and are not words/tokens themselves. So the error is to be expected.
The question is rather why you are trying to look up whitespaces in the first place. That shouldn’t happen. Usually you have something like:
sentence = 'This is a normal sentence, nothing special.'
tokens = tokenize(sentence, separator=' ')
# tokens = ['This', 'is', 'a', 'normal', 'sentence, ',', 'nothin', 'special', '.']

Is there any chance that you have sentence with more than one whitespaces in a row, and your tokenizer gets thrown off by that, for example:
sentence = 'This sentence has a gap     with five whitespaces.'

Maybe in this case tokens then contains whitespaces as elements. Anyway, there should be no situation where you have to look up whitespaces.