You aren't explicitly prevented from splitting your attacks but since you only have one valid target you are practically prevented from doing so. See the rules for splitting attacks:
If you choose to split its attacks, you must split them between an initial target model, chosen as described above, and any number of enemy models within 2" of that target that are also eligible targets.
Emphasis mine. This scenario practically no different than shooting at an enemy model that has another enemy model within 2" but out of line of sight of the attacker. Although the model is in range of the weapon and within 2" of the primary target it is not visible which means it's not an eligible target. In this scenario the other enemy model is not the closest enemy model, which means it's not an eligible target for the pistol attacks.