code: private boolean isDeletedResource(String path, boolean rootPath) {
  
          CmsObject cms = getCmsObject();
          CmsResource res = null;
          try {
              if (rootPath) {
                  String origSiteRoot = cms.getRequestContext().getSiteRoot();
                  try {
                      cms.getRequestContext().setSiteRoot("");
                      res = cms.readResource(path, CmsResourceFilter.ALL);
  
                  } finally {
                      cms.getRequestContext().setSiteRoot(origSiteRoot);
                  }
              } else {
                  res = cms.readResource(path, CmsResourceFilter.ALL);
              }
          } catch (CmsException e) {
              // ignore
          }
          return (res != null) && res.getState().isDeleted();
      }
docs: Checks if a the resource exists but is marked as deleted.<p>
  
  @param path the path
  @param rootPath in case the path is a root path
  
  @return true is the resource exists but is marked as deleted