Can the pilot stop airflow between cockpit and cabin?
fire If there is smoke in the cabin, the pilot would need to prevent
  the smoke from entering the cockpit.


This is a bit more complex as the cockpit door by its own nature will slow the flow of smoke but will not stop it all together. Smoke flow is also dependent on the movement of air within the aircraft. In your example of SR-111 the smoke was not in the cabin but in the overhead section so closing the cabin door would not have accomplished much. While smoke barriers are installed ultimately in a fire situation its only a matter of time before another hole is burned through. This is why early identification and extinguishing is so key. By the nature of cockpits things like wire bundles, cable chases, and at one time in history control cables must come and go so you cant truly seal a cockpit anyway.   


  hull breach Does cabin depressurization (due to a hull breach for
  example) directly lead to cockpit depressurization? Or can the pilot
  prevent this by stopping the air outflow from the cockpit to the
  cabin?
  
  MH370 One working hypothesis in the MH370 mystery is accidental or
  deliberate cabin depressurization. Assuming the latter, is there any
  way the perpetrator in the cockpit could prevent the cockpit
  depressurization ?


You can generally lump these into the more general question of "can the cockpit be pressurized separately from the rest of the aircraft" to which the broad answer is no. Simplly put the cockpit door is not capable of serving as a bulkhead and cant withstand the pressure differential, as far as I know they also lack any sort of sealing, bracketing or joints for such a task. The only aircraft I can really think of that ever had a feature like this was the B29 Super fortress which had independent fore and aft sections that were independently pressurized. This allowed an unpressurized bomb bay in the center. To make this possible both sections had small pressure doors to allow entry. 



(source)

The only thing a flight crew could do, is potentially depressurize the whole aircraft and use the pilot and co-pilot 02 system to outlast the cabin 02 masks, then decent below FL100 and breathe normally.