Blender starts, by default, with a cube centered on 0,0,0. If you hold down the control key, the cube will move in increments as you reposition it in 3D space (with G and the mouse, or the translation widgit). Position one side of the cube so it lines up with the z axis the way you want it, then delete the other sides of the cube. Voila: a 2D square lined up with the Z axis.
But, it might not be “your” 2D square. There may be considerations I know nothing about. As Richard Marklew said, post a screen shot or a blend file. You’re new, so you might not be able to use BlenderArtists ‘manage attachments’ feature yet, but you can post stuff on pasteall.org and put the link here.
Welcome to BlenderArtists