There are a few issues with your code:
\ifx doesn't expand its arguments, but only compares the first two tokens following it, in your case \csname and f, which always yields false. You need to use \expandafter to build the \csname before \ifx does its job.
the macro \empty is short (meaning it doesn't use \long in its definition), whereas macros created with \newcommand are by default \long. You'll need to use \newcommand* and \renewcommand*, or after the first \newcommand* directly \def instead of \renewcommand*.
your macro's replacement text starts with a spurious space, you have to comment out the line ending after {, like so: \newcommand\checkit{%. You don't have to comment out line endings after macro names, so the line containing the \ifx and \fi are fine, another (possibly) unwanted space occures after the word empty.
I don't know what should happen in the case that \foovi isn't yet defined, so I decided to let this case throw the <false> branch. You can easily change that if you want.
I defined your macro \checkit to take two arguments (not immediately, but the used \@secondoftwo, \@secondofthree and possibly \@firstoftwo will take those arguments). So the macro will now behave as \checkit{<true>}{<false>} and execute the corresponding branch if the macro has the meaning \@empty (which is the same as \empty, but since we're in \makeatletter we could as well use the less likely to be redefined macro \@empty).
\documentclass[]{article}
\newcounter{bar}
\makeatletter
\providecommand@secondofthree[3]{#2}
\newcommand\checkit
{%
@ifundefined{foo\romannumeral\value{bar}}%
{%
% undefined
@secondoftwo % should result in <false>
%@firstoftwo % should result in <true>
}
{%
\expandafter\ifx\csname foo\romannumeral\value{bar}\endcsname@empty
\expandafter@secondofthree
\fi
@secondoftwo
}%
}
\makeatother
\begin{document}
\setcounter{bar}{6}
\checkit{empty}{not empty}
\newcommand*\foovi{hello}
\checkit{empty}{not empty}
\renewcommand*\foovi{}
\checkit{empty}{not empty}
\end{document}
Result:

\ifx, any other options are welcome! – yegor256 Aug 30 '21 at 05:00\makeatletter \newcommand\checkit{The command foo\romannumeral\the\value{bar} \@ifundefined{foo\romannumeral\the\value{bar}}{ doesn't exist!}{ exists: \csname foo\romannumeral\the\value{bar}\endcsname{}}} \makeatother. – Mico Aug 30 '21 at 05:18