A SequenceFlow in a SubProcess must have its origin and target in the same SubProcess.
BPMN SubProcesses represent independent processes. Therefore all the parts of a subprocess sequence must be in that subprocess.
If you have a subprocess sequence that has SequenceFlows coming out of or leading out of the subprocess, you should keep in mind that a subprocess should have a StartEvent and an EndEvent, and only one sequence. These rules should ensure that you do not have any coming out of or leading out of the subprocess.