Ah. In that case it depends on whether the command you're looking to stop presses any keys using keypress actions.
If not, you could run a separate command (started by the command you're looking to stop) that uses a loop set up via the "Device State" to run while no keys are pressed, and to stop the other command after the loop (so that the action triggers once the loop stops when a keypress is detected).
E.G.
Start Loop While : No Keyboard Key Is Pressed
End Loop
Write [Blue] 'Keypress detected, command stopped' to log
Kill command, 'Name of the command to be stopped'
Assuming the command that would be stopped doesn't loop forever, you'd probably also want to add an action at the end of it that stops the command that's running the loop, so it doesn't keep waiting when the command that should be stopped has stopped by itself already.
If, on the other hand, the command you're looking to stop uses keypress actions, you'd need to rig up a system where the monitoring command checks whether the key that has been pressed was likely pressed by the other command (E.G. by setting a variable containing the key(s) pressed in the other command, then checking whether the pressed key was listed in the monitoring command)