Draw parts of a split rectangle in a dashed/dotted style

Draw the whole border after the node is built:

\documentclass[tikz,border=2mm]{standalone}

\usetikzlibrary{shapes.multipart, calc}

\begin{document}

\begin{tikzpicture}

\node[rectangle split,rectangle split parts=2, rectangle split horizontal,
    align=center,
    alias=othername, 
    append after command={\pgfextra
        \draw ($(othername.one split south)!.25!(othername.south east)$)-|(othername.west)|-($(othername.one split north)!.25!(othername.north east)$);
        \draw ($(othername.one split south)!.75!(othername.south east)$)-|(othername.east)|-($(othername.one split north)!.75!(othername.north east)$);
        \draw[dashed] ($(othername.one split south)!.25!(othername.south east)$)--($(othername.one split south)!.75!(othername.south east)$);
        \draw[dashed] ($(othername.one split north)!.25!(othername.north east)$)--($(othername.one split north)!.75!(othername.north east)$);
        \draw (othername.one split north)--(othername.one split south);
    \endpgfextra} ]
  {foo \nodepart[text width=2cm, draw=none]{second} bar};

\end{tikzpicture}
\end{document}

enter image description here


Try overdraw the second part of multi part node with white dashed line:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{shapes.multipart}

\begin{document}
    \begin{tikzpicture}[
node distance = 0pt,
  mpnh/.style = {% multi part node horisontal
        rectangle split, rectangle split parts=2,
        rectangle split horizontal, 
        draw, outer sep=0pt, align=center}
                        ]
\node (mpnh) [mpnh]
    {foo 
    \nodepart[text width=2cm]{second} bar};
\draw[white, semithick, dashed] (mpnh.two north)+(-0.5,0) -- ++ (.5,0)
                                (mpnh.two south)+(-0.5,0) -- ++ (.5,0);
    \end{tikzpicture}
\end{document}

enter image description here