I have tried this way but not able to hide “confirmation_id” element.
public function buildForm(array $form, FormStateInterface $form_state, $sid = NULL) {
$my_webform_machinename = 'request_form';
$my_form = DrupalwebformEntityWebform::load($my_webform_machinename);
$my_form['elements']['flexbox_layout']['confirmation_id']['#access'] = FALSE;
return [
'form' => [
'#type' => 'webform',
'#webform' => $my_form,
'#sid' => $sid,
],
];
}