How to unpublish nodes which are missing in migration source?
I have used an EventSubscriber for this. Here is my code.
/**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events = [];
    $events[MigrateEvents::PRE_IMPORT][] = ['archiveMissingNodes'];

    return $events;
  }

  /**
   * Archives the missing contact persons.
   *
   * @param \Drupal\migrate\Event\MigrateImportEvent $event
   *   The migration import event.
   *
   * @throws \Drupal\Core\Entity\EntityStorageException
   */
  public function archiveMissingNodes(MigrateImportEvent $event) {
    $migration = $event-&gt;getMigration();

    if ($migration-&gt;id() === 'my_migration_id') {
      $id_map = $migration-&gt;getIdMap();
      $id_map-&gt;prepareUpdate();

      // Clone so that any generators aren't initialized prematurely.
      $source = clone $migration-&gt;getSourcePlugin();
      $source-&gt;rewind();
      $source_id_values = [];

      while ($source-&gt;valid()) {
        $source_id_values[] = $source-&gt;current()-&gt;getSourceIdValues();
        $source-&gt;next();
      }
      $id_map-&gt;rewind();

      while ($id_map-&gt;valid()) {
        $map_source_id = $id_map-&gt;currentSource();

        $destination_ids = $id_map-&gt;currentDestination();

        if (!empty($destination_ids['nid'])) {
          $node = $this-&gt;nodeStorage-&gt;load($destination_ids['nid']);

          if ($node instanceof NodeInterface) {
            if (!in_array($map_source_id, $source_id_values, TRUE) &amp;&amp; $node-&gt;get('moderation_state')-&gt;getString() !== 'archived') {
              $node-&gt;setNewRevision(TRUE);
              $node-&gt;set('moderation_state', 'archived');
              $node-&gt;set('revision_log', '');
              $node-&gt;setRevisionCreationTime($this-&gt;time-&gt;getRequestTime());
              $node-&gt;setRevisionUserId($this-&gt;currentUser-&gt;id());
              $node-&gt;setRevisionTranslationAffected(TRUE);
              $node-&gt;save();
            }
          }
        }

        $id_map-&gt;next();
      }
    }
  }