One option is to use the built-in profile switcher to switch to and from a profile that will toggle the listening state by using the "Execute a command each time this profile is loaded" option.
The single command in that profile would look something like this:
Begin Device State Check : Keyboard Key 'Shift' Is Pressed
End Condition - Exit when condition met
Stop VoiceAttack listening
Start Loop While : [{ACTIVEWINDOWTITLE}] Contains 'Retroarch'
End Loop
Start VoiceAttack listening
Switch to profile, '{PREVIOUSPROFILE}' (by name)
It'll monitor a key which you can hold down when switching to the profile manually so you can modify the command/profile while the target application is not running(otherwise it'll switch back to the previous profile right away).
More information on profile auto-switching can be found in VoiceAttackHelp.pdf page 12 and 13
If you want to check for a process instead(which the auto-switcher supports), you'll also want to swap the {ACTIVEWINDOWTITLE} token for the {PROCESSEXISTS:} token, and set a text variable for the latter to use.