How do I conditionally add a field?
I don't have much experience in Drupal 8. Please refer my suggestion bellow.


Please add wrapper item for the ajax call
eg:  


$form['flat_per_floor'] = array(
    '#type' => 'textfield',
    '#title' => $this->t('Flat Per Floor'),
    '#default_value' => $flatPerFloor,
    '#ajax' => array(
        'callback' => 'Drupal\bms_flat\Form\FlatForm::flatGenerate',
        'effect' => 'fade',
        'event' => 'change',
        'method' => 'replace',
        'progress' => array(
            'type' => 'throbber',
            'message' => "Generating..",
        ),
        'wrapper' => 'flat-per-floor-wrapper',
    ),
);

Add the wrapper container under the flat_per_floor field

 
$form['flat_per_floor_wrapper'] =  array(
  '#type' => 'container',
  '#attributes' => ['id' => 'flat-per-floor-wrapper']
);
 

For more details please refer the example module for drupal 8 and check the ajax form
https://www.drupal.org/project/examples