Can I used the command line to disable settings in Yosemite that have made my Mac visible? Recent changes to my machine as the result of an upgrade to Yosemite (OS X 10.10) have made my machine visible on Bluetooth and Bonjour, where it was not visible before.

Is there a command line way to disable/enable the relevant features so that my machine can be restored to "invisibility" to these services (e.g. when I'm in a less secure environment)?
Bonjour
Prior, to Yosemite this could be done via launchctl, so using:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

would turn Bonjour off, and to turn it back on:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Unfortunately /usr/sbin/mDNSResponder is not found on Yosemite.
A bit of digging and this seems to work for Bonjour:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

NB: I'm not clear if this means it stays off, it should given launchctl behaviour but I've have not had time to test it and determine if anything else in the system will turn it back on.
Bluetooth
Presuming you're talking about your Mac's built-in bluetooth and not a third party adaptor, then:
networksetup -listallnetworkservices

Lists all services, usually show Bluetooth as 'Bluetooth DUN'
killall blued

Kills the bluetooth server process
Launchctl commands
launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist

Unload the bt daemon
launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist

Reload the bt daemon
launchctl start com.apple.blued

Restart blued daemon