Accurate and real-time traffic flow prediction is a crucial component of Intelligent Transportation Systems as it provides effective guidance for traffic management and driving planning. Recent studies have emphasized the importance of spatio-temporal modeling and federated learning in enhancing prediction accuracy and preserving data privacy. However, existing methods often neglect topology protection and pose risks of privacy leakage when extracting spatial characteristics of traffic flow from the global topology. In light of this, this paper focuses on the node-level scenario, where neither the server nor clients own the global topology. Instead, clients only have information about their respective connections. In this context, we present a random walk algorithm to extract spatial features of clients and introduce ST-TPFL, a framework for spatio-temporal traffic flow prediction based on topology-protected federated learning. Unlike methods that rely on Graph Neural Networks to extract spatial features from the global topology, ST-TPFL offers substantial reductions in communication and computational costs, making it better suited for dynamically changing topologies. The experimental results on two public datasets demonstrate that ST-TPFL can ensure prediction accuracy while safeguarding topology privacy at lower computational and communication costs.