Very simple indeed. Build an aircraft which has absolutely NO access to the flight deck from the cabin ie pilots have their own entry door from the outside. In the cockpit is a galley and loo (as El Al have done to their 747s - door welded locked for the duration of the flight)