Spanning tree is usually defined for Connected Undirected Graphs only. This is due to the definition of “Tree”, as tree is a Connected Acyclic Undirected Graph.
For EVERY Connected Undirected Graph we have a spanning tree.
For Disconnected Undirected Graphs, we can define “Spanning Forest”.
For Directed Graphs, we can defined “Directed Spanning Trees”