You can wrap all the tick labels in a rotatebox by using the \ticklabel key (instead of \ticklabels) and defining the references in a list with \noexpand so they survive all the processing. You should use an anchor that is equivalent to the rotation of the labels, to avoid getting an offset:
\documentclass{article}
\usepackage{hyperref}
\usepackage{rotating}
\usepackage{pgfplots}
\usepackage{nameref}
\usepackage{graphicx}
\begin{document}
\section{the beginning}
This is a test.\label{test} \\
This is \nameref{test}.
\section{second section}
Test two \label{testtwo}
\newcommand{\nenameref}[1]{\noexpand\nameref{{#1}}}
\begin{tikzpicture}
\def\labellist{{"\nenameref{test}","\nenameref{testtwo}","reallylonglabel"}},
\begin{axis}[xtick={1,...,3},
xticklabel={\pgfmathparse{\labellist[\tick-1]}\rotatebox{65}{\pgfmathresult}},
x tick label style={anchor=65}]
\addplot+[only marks,
error bars/.cd,
y dir=both,
y explicit,
error bar style={line width=2pt},
error mark options={
rotate=90,
red,
mark size=8pt,
line width=2pt}
]
coordinates {
(3,1) +- (0,0.35665)
(2,1) +- (0,-0.35048)
(1,1) +- (0,0.150255)
};
\end{axis}
\end{tikzpicture}
\end{document}
