How to make invisible a line in TikZ

Replace \draw by \path:

\documentclass[11pt]{article}

\usepackage{pgfplots}
\usepackage{tikz}

\usetikzlibrary{
   decorations.markings,
   decorations.pathmorphing,
   calc,
   patterns,
   positioning
}

\tikzset{
      spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}},
      blank/.style={draw=none,fill=none,pos=0.5},
      ground/.style={fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.3cm},
      damper/.style={thick,
         decoration={markings, mark connection node=dmp,
           mark=at position 0.5 with
          {
            \node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=10pt,minimum height=3pt,draw=none] {};
            \draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
            \draw [thick] ($(dmp.north)+(0,-3pt)$) -- ($(dmp.north)+(0,3pt)$);
          }
          }, decorate
      },
     box/.style={draw,thick,minimum width=1cm, minimum height=1cm}
    }

\begin{document}    

\begin{figure}[tbp]
\centering
\begin{tikzpicture}[node distance=3cm]
        \node (wall) [ground, rotate=-90, minimum width=2cm] {};
        \node (M1) [box, right=of wall.north] {$m_1$};
        \node (M2) [box,right=of M1,label=below:$f$] {$m_2$};

        \draw (wall.north east) -- (wall.north west);
        \draw [spring] (wall.north) -- (M1) node[blank,above,yshift=1mm] {};
        \path (wall.20) -- (wall.20 -| M1.west) coordinate (d1);

        \draw [spring] (M1) -- (M2) node[blank,above,yshift=1mm] {} ;
        \draw [damper] (d1-|M1.east) -- (d1 -| M2.west);

        \node (wall2) [ground, right=of M2, anchor=north,rotate=90,minimum width=2cm] {};
        \draw [spring] (M2) -- (wall2) node[blank,above,yshift=1mm] {};
        \draw [damper] (d1-|M2.east) -- (d1 -| wall2.north);
\end{tikzpicture}
\end{figure}
\end{document}

I want to expand on the comment of Ignasi.

You can also make any line invisible by adding the option

draw=none

to the tikz command that is drawing. This option has some advantages that I comment below.

In your case, you have to change the line

 \draw (wall.20) -- (wall.20 -| M1.west) coordinate (d1);

by

 \draw[draw=none] (wall.20) -- (wall.20 -| M1.west) coordinate (d1);

Advantages

See TikZ Manual 3.1.5b Section 15.3 Drawing a path: "If the special color name none is given, this option causes drawing to be “switched off”. This is useful if a style has previously switched on drawing and you locally wish to undo this effect."

As an example of usefulness, imagine you have a scope where all the node frames are set to be drawn (every node/.style=draw), but you want to make an exception (see node C)

\begin{tikzpicture}

\begin{scope}[every node/.style=draw]
\path (0,0) node{A};
\path (0,1) node{B};
\path (1,0) node[draw=none]{C};
\path (1,1) node{D};
\end{scope}

\end{tikzpicture}

enter image description here