I make the assumption that B starts searching A from a process list...
Scenario 1: The program checking for the other program does not require administrative rights to run.
If program B doesn't require administrative rights to run (including no use of services running with admin rights), execute it in the context of another user account on your computer that does not have admin rights. To do so, Shift+Right-Click the program to get the Run as different user option.
The program will run in the context of the other user account, and because the account doesn't have admin rights, it cannot enumerate processes running in the context of other users. Therefore it won't be able to "see" the other program's process.
If you need the programs to share access to filesystem or Registry resources, simply grant both user accounts access to said resources. Doing so won't allow the one program to see the other.
Scenario 2: The program checking for the other program DOES require administrative rights to run.
An application with that runs in the context of an account with administrative permissions can do anything it wishes on your computer, making it extremely challenging to subvert its prerogative to exercise those privileges. The only way forward would be to know the exact tests the program is performing to determine if the other app is running, and then hook the various API function calls involved to remove the target program's existence from the data being returned. This is how rootkits hide their presence on a computer. Doing this falls well outside the scope of this specific answer (and the Super User site in a general).