Is there any way a human could whistle and be unable to speak?
Short answer(s)
Someone with a damaged larynx may still speak with the use of a speech aid (electronic larynx). 

The ability to understand speech does not necessarily mean one can speak normally. There are neurological disorders where folks can understand speech, but have difficulty producing it.

Background
A full removal of the larynx (laryngectomy) prevents the patient to produce speech because the vocal chords are removed. However, with the use of a voice prosthesis this can be solved (Cancer Research UK). 

There are neurological disorders where one can still understand speech, but has impaired ability to generate it, called apraxia. Apraxia can be acquired or congenital (developmental) (NIH). The developmental type is not well understood a the neural level (Dyspraxia Foundation UK). The acquired type is known to occur through damage to specific brain areas, for example due to trauma or stroke. One of these areas associated with acquired apraxia is Broca's area (Graff-Radford et al., 2014), which is a brain area intimately associated with the production of speech . 


Broca's area. Source: UC Irvine

However, although damage to this area can result in pure apraxia (i.e., impaired speech but normal speech understanding), it can also result in Broca's aphasia, which means that language understanding is also impaired (American Heart Association). Moreover, regarding your specific question, apraxia is characterized by impaired speech, but not a total lack of speech production.     

Reference
Graff-Radford et al. Brain &amp; Language 2014;129:43–6