How to Rotate on a specific axis??

Im making a 2d space game and started making the basic AI for enemys, i’m trying to make it point towards my player but because the aliens just a texture,it rotates all axis to point towards me, and that involves depth, is there a way to make it just turn on the Z Axis??
using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
	public Transform target;
	public int moveSpeed;
	public int rotationSpeed;

	private Transform myTransform;

	// Use this for initialization
	void Awake() {
		myTransform = transform;
	}



	void Start () {
		GameObject go = GameObject.FindGameObjectWithTag("Player");

		target = go.transform;
	}
	
	// Update is called once per frame
	void Update () {
		Debug.DrawLine (target.transform.position, myTransform.position);
		myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
	}
}

Try this:

Vector3 dir = target.position - myTransform.position;
dir.z = 0.0f; // Only needed if objects don't share 'z' value
if (dir != Vector3.zero) {
    angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
    myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.AngleAxis(angle, Vector3.forward), rotationSpeed * Time.deltaTime);
}

An alternate solution:

Vector3 dir = target.position - myTransform.position;
dir.z = 0.0f; // Only needed if objects don't share 'z' value
if (dir != Vector3.zero) {
    myTransform.rotation = Quaternion.Slerp (myTransform.rotation, 
Quaternion.FromToRotation(Vector3.right, dir), rotationSpeed * Time.deltaTime);
}

Both solutions assume the right side of your 2D object is forward.