\documentclass[a4paper]{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.4}

\begin{document}

\begin{tikzpicture}
	\begin{axis}
	\addplot3 table
	{
		x y z1 z2
		0 0 0  1
		1 1 0  2
		2 2 0  3
	};
	\addlegendentry{default}

	\addplot3 table[z=z2]
	{
		x y z1 z2
		0 0 0  1
		1 1 0  2
		2 2 0  3
	};
	\addlegendentry{z=z2}

	\addplot3 table[z index=3]
	{
		x y z1 z2
		0 0 0  1
		1 1 0  2
		2 2 0  3
	};
	\addlegendentry{z index}
	\end{axis}
\end{tikzpicture}
\end{document}

